Page 1 of 1

Confused about Regular Expression

Posted: 14 Oct 2017, 04:03
by dsewq1LYJ
I try to match whole dictionary block by using RegExMatch()

This pattern works like a charm in regex101

Image

but not work with AutoHotkey, here is the code.

Code: Select all

while (re_pos := RegExMatch(Text, "O)(\t){0,}for k,v in ([^}]|\s)*+}", re_occur, (re_pos ? re_pos + 1 : 1)))
{
  MsgBox % ": " re_occur[0]
}

Re: Confused about Regular Expression  Topic is solved

Posted: 14 Oct 2017, 05:27
by just me
You might need the s option for AHK:

Code: Select all

while (re_pos := RegExMatch(Text, "Os)\t*for k,v in [^}]*}", re_occur, (re_pos ? re_pos + 1 : 1)))
{
   MsgBox % ": " re_occur[0]
}

Re: Confused about Regular Expression

Posted: 16 Oct 2017, 06:27
by dsewq1LYJ
just me wrote:You might need the s option for AHK:

Code: Select all

while (re_pos := RegExMatch(Text, "Os)\t*for k,v in [^}]*}", re_occur, (re_pos ? re_pos + 1 : 1)))
{
   MsgBox % ": " re_occur[0]
}
Thank you so much !
It worked ! :dance: