In order to assign the Delete string after any number of digits when pressing the "no conversion" key in AutoHotKey, I ran the following script and got an error message.
Current State Script:
<vk1D::
StrMsg_in: = "1234567890 hogehoge"
StrMsg_out: =RegExReplace(StrMsg_in, (?<=[0-9]{10}).*, "")
Clipboard: = StrMsg_out
Send,^v
return
error messages:
Error: Unexpected"{"
--- Abbreviated ---
--- >StrMsg_out: =RegExReplace(StrMsg_in, (?<=[0-9]{10}).*, "")
--- Abbreviated ---
Also, if you set the [0-9]
to \d
, the following error message was printed:
Line Text:\d
Error The leftmost character above is illegal in an expression.
The program will exit
If anyone knows how to solve this problem or how to solve it, please let me know.
regular-expression autohotkey
Try tying the pattern (regular expression) part of RegExReplace
with a double quote".
StrMsg_out: =RegExReplace(StrMsg_in, "(?<=[0-9]{10}).*", ")
Note: Example of using regular expressions in official documents
https://www.autohotkey.com/docs/commands/RegExReplace.htm#Examples
MsgBox%RegExReplace("abcXYZ123", "abc(.*)123", "aaa$1zz")
© 2024 OneMinuteCode. All rights reserved.