RegEx back tick modifier question Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
carno
Posts: 265
Joined: 20 Jun 2014, 16:48

RegEx back tick modifier question

31 Dec 2017, 03:13

Happy New Year! I was analyzing the following code and could not understand the meaning of modifiers `am) [I think modifier m) stands for multiline but my big question is regarding `a) or `a (specifically the meaning and function of the back quote or back tick also called "grave accent" here). Also, any comments that analyzes this code in more detail is appreciated:

Code: Select all

Haystack=
(
25
30
100
70
70
100
40
105
35
180
10
190
30
5
275
)
MsgBox % RegExReplace(Haystack, "`am)^(?!(5|10|15|20|25|30)$).*\v*")
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

Re: RegEx back tick modifier question  Topic is solved

31 Dec 2017, 07:32

From the docs:
[v1.0.46.06+]: `a recognizes any type of newline, namely `r, `n, `r`n, `v/VT/vertical tab/chr(0xB), `f/FF/formfeed/chr(0xC), and NEL/next-line/chr(0x85). [v1.0.47.05+]: Newlines can be restricted to only CR, LF, and CRLF by instead specifying (*ANYCRLF) in uppercase at the beginning of the pattern (after the options); e.g. im)(*ANYCRLF)^abc$.
https://autohotkey.com/docs/misc/RegEx- ... tm#Options

And yes, m is multiline.


What are You trying to achieve with your RegEx pattern?
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.
carno
Posts: 265
Joined: 20 Jun 2014, 16:48

Re: RegEx back tick modifier question

31 Dec 2017, 07:50

Thanks SirRFI for answering my question. I did not know the link your provided existed and that solved my problem. I was not trying to achieve any particular RegEx pattern, but rather was studying and learning RegEx through examples and came across this one as an exercise.
lexikos
Posts: 9604
Joined: 30 Sep 2013, 04:07
Contact:

Re: RegEx back tick modifier question

31 Dec 2017, 17:48

RegExReplace doesn't actually see ` and a; it sees a character with ordinal value 7 (Chr(7)). ` is AutoHotkey's escape character.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Rohwedder, Scr1pter and 142 guests