RegEx lookbehind assertion question Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Posts: 566
Joined: 06 Dec 2018, 04:36

RegEx lookbehind assertion question

18 Jun 2019, 07:35


In the look-behind assertionn, can't the condition be an option with a Non-fixed length?
For example, in the following example, I tried to match bc in abc,d with [^,]+. The expected result is d.

Code: Select all


User avatar
Posts: 613
Joined: 01 Oct 2013, 08:01

Re: RegEx lookbehind assertion question  Topic is solved

18 Jun 2019, 14:16

Look-ahead and look-behind assertions wrote: Look-behinds are more limited than look-aheads because they do not support quantifiers of varying size such as *, ?, and +.
User avatar
Posts: 6722
Joined: 19 Dec 2016, 01:58
Location: UK

Re: RegEx lookbehind assertion question

18 Jun 2019, 16:48

You can try \K:

Code: Select all

q:: ;test RegExMatch \K
RegExMatch("abc,d", "O)a[^,]+,\K\w", oMatch)
MsgBox, % oMatch.0
RegExMatch("abc,d", "O)a[^,]+,(\w)", oMatch)
MsgBox, % oMatch.1
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask For Help”

Who is online

Users browsing this forum: BeatboxHero, Bing [Bot], Chunjee, Flipeador, KilliK, pn4265, Qtic, teadrinker, TheUnknown138, x-tremespeed and 67 guests