I am currently developing a very “simple” script in AutoHotKey, but it involves using hotstrings following the format:
::btw::by the way
which would detect whenever a user types “btw” and replace it with “by the way”.
However, whenever I try to put a regular expression in between the colons, it interprets it literally. Is there any way to use regular expressions with hotstrings? Workarounds are accepted.
Hotstrings don’t natively support RegEx,
but there is RegEx Powered Dynamic Hotstrings which I’ve never tried.
Your other option is a Loop with the Input command inside of it.
That would require an end character, such as space.
Then you would have the script analyze what the Input command returns with RegExReplace.
Place the number in the regular expression in a capturing group and use it as a back-reference in the replacement. But unless the pattern always has the digit in the same place I think it would require two steps (with RegExMatch) as shown in this working example:
Type any sequence of six with five letters and one digit,
press space and it will replace the sequence with only the number.