Regexreplace fails to repalce "|" pipe

Get help with using AutoHotkey and its commands and hotkeys
MonuKashyap
Posts: 74
Joined: 06 Jun 2016, 21:32

Regexreplace fails to repalce "|" pipe

18 Aug 2020, 09:02

Code: Select all

newvar=1||2|3|4
var=|2
newvar := RegExReplace(newvar, var) ;;works incorrect
msgbox % newvar
in the above code the command Regexreplace successfully replaces 2, but failed to replace this pipe "|"
as shown in screenshot.

Regards,
An Ahk User
Attachments
mtest.PNG
mtest.PNG (2.01 KiB) Viewed 50 times
Last edited by BoBo on 19 Aug 2020, 01:13, edited 1 time in total.
Reason: Moved to 'Ask for Help'-section.
swagfag
Posts: 4126
Joined: 11 Jan 2017, 17:59

Re: Regexreplace fails to repalce "|" pipe

18 Aug 2020, 09:09

| is a special regex symbol that needs escaped if it's meant to be used literally

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Google [Bot], Ioniq, jacek678, testsite, zvit and 48 guests