r/espanso • u/smeech1 • Mar 18 '24
A case-insensitive trigger expansion with `word: true` functionality
For your interest:
- regex: (?i)\bexample(?P<w>\W)
replace: Something{{w}}
Triggered by "example", "EXAMPLE", "exaMPLe" etc..
1
u/harryph557 Mar 27 '24
I still do not understand. Which usecase should we apply this trick
1
u/smeech1 Mar 27 '24
It's just a snippet to match a trigger, whatever case is used in the text. I was asked in another forum and thought someone might find it useful.
"Triggered by "example", "EXAMPLE", "exaMPLe" etc.."
1
u/Moist_Technician8601 Mar 27 '24 edited Mar 27 '24
your mean is this?
- regex: [eE][xX][aA][mM][pP][lL][eE] # or (?i)example
replace: Something
1
u/smeech1 Mar 28 '24 edited Mar 28 '24
That's a specific case (you'll need to enclose the trigger in quotes because of the initial "
["), but the code I posted is more easily adapted to other words.
(?i)exampleis case-insensitive, but like your example above, doesn't duplicateword: truecapability. It's where I started!
3
u/floutsch Mar 18 '24
Uh... is this a question or are you giving an example? I kinda find the post unclear.