Help with RegExMatch "\d{5}" Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
djuga
Posts: 88
Joined: 28 Jul 2019, 08:16

Help with RegExMatch "\d{5}"

22 Apr 2021, 05:59

Should be ignored if there are more than 5 consecutive digits

Code: Select all

String := "ighja111222dafghjasf43421dweqlopd22267891djcxoa"

RegExMatch(String, "\d{5}", m)

MsgBox % m ; Get 11122 , need 43421
My questions are baffling! :crazy:
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Help with RegExMatch  Topic is solved

22 Apr 2021, 06:12

Code: Select all

String := "ighja111222dafghjasf43421dweqlopd22267891djcxoa"
RegExMatch(String, "(?<!\d)\d{5}(?!\d)", m)
MsgBox % m ; Get 11122 , need 43421
"first sequence of exactly 5 digits, not immediately followed by another digit"
djuga
Posts: 88
Joined: 28 Jul 2019, 08:16

Re: Help with RegExMatch

22 Apr 2021, 06:17

swagfag wrote:
22 Apr 2021, 06:12

Code: Select all

String := "ighja111222dafghjasf43421dweqlopd22267891djcxoa"
RegExMatch(String, "(?<!\d)\d{5}(?!\d)", m)
MsgBox % m ; Get 11122 , need 43421
"first sequence of exactly 5 digits, not immediately followed by another digit"
Yes its it! Thx! :lol:
My questions are baffling! :crazy:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, ReyAHK and 264 guests