Code: Select all
Unwrapped := RegExReplace(Unwrapped, "\bA\b" , "1")
(\b is to match the whole word)
(I did not find the answer here https://autohotkey.com/docs/commands/StringReplace.htm )
Code: Select all
Unwrapped := RegExReplace(Unwrapped, "\bA\b" , "1")
Code: Select all
Unwrapped:=RegExReplace(Unwrapped, "(A|B|C)", "1")
Code: Select all
Unwrapped:=RegExReplace(Unwrapped, "(\bA\b|\bB\b|\bC\b)", "1")
Code: Select all
q:: ;replace strings (whole-word match)
vText := "A B C AA BB CC A B C a b c aa bb cc a b c"
;case sensitive:
MsgBox, % RegExReplace(vText, "\b(A|B|C)\b", "1")
MsgBox, % RegExReplace(vText, "\b[ABC]\b", "1") ;if each needle is 1 char long
;case insensitive:
MsgBox, % RegExReplace(vText, "i)\b(A|B|C)\b", "1")
MsgBox, % RegExReplace(vText, "i)\b[ABC]\b", "1") ;if each needle is 1 char long
return
Users browsing this forum: No registered users and 294 guests