Regular Expressions - Lookaround.Lookbehind

Jimjam

New member
Local time
Today, 14:23
Joined
Nov 22, 2012
Messages
7
I am using Guus2005's Regular expression function so graciously contributed to the code repository. It's been great so far.

I have run into a bit of an issue regarding the 'lookaround' functionality (allows a pattern match to be broader than the return value).


immediate:
'The positive lookahead seems to work nicely...
'Ex. we only want the s returned but it must be followed by an h in the source string.
?Regexp("ashes", "s(?=h)")
s


'PROBLEM: The lookbehind syntax does not seem to find or return anything.?.
'Ex. we only want the h returned but it must be PRECEDED by an s in the source.
?Regexp("ashes", "(?<=s)h")
h <--expected but nothing is returned.

I am *hoping* I just am using the wrong syntax.
I am fearing it is a limitation of the VBScript.Regex function being called.

Flummoxed.
 
In plain English WHAT are you trying to do?

Can you show the data and what you want as a result?
 
From what i can see the pattern match syntax is correct. Try it as a Negative Lookback EG "(?<!s)h"), it may just be a glitch. Guus has a link to the article that led to him creting the function. Have you looked at that?

I have used this function of Guus's quite a lot and not noticed any issues.
 
The negative lookback isn't working either. It is after-all a limitation of the VBScript.regex function. A shame because lookforward and lookback are both equally valuable.

I'll just move ahead without it.

Thanks to you both.
 

Users who are viewing this thread

Back
Top Bottom