Confused about Regular Expression Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
dsewq1LYJ
Posts: 114
Joined: 26 Aug 2014, 23:21

Confused about Regular Expression

14 Oct 2017, 04:03

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]
}
just me
Posts: 7389
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Confused about Regular Expression  Topic is solved

14 Oct 2017, 05:27

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]
}
dsewq1LYJ
Posts: 114
Joined: 26 Aug 2014, 23:21

Re: Confused about Regular Expression

16 Oct 2017, 06:27

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:

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], mikeyww, nathan323, thebbandit and 38 guests