Confused about Regular Expression Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dsewq1LYJ
Posts: 116
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: 9453
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: 116
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 (v1)”

Who is online

Users browsing this forum: Araphen, ArkuS, claudiosxj, Descolada, mikeyww, OrangeCat and 333 guests