Re: Positive lookahead assertion
- From: "Paddy" <paddy3118@xxxxxxxxxxxx>
- Date: 7 Sep 2006 13:28:59 -0700
tobiah wrote:
(?=...)Its all about context. If you want to match something but only if it
Positive lookahead assertion. This succeeds if the contained
regular expression, represented here by ..., successfully
matches at the current location, and fails otherwise.
But, once the contained expression has been tried, the
matching engine doesn't advance at all; the rest of the
pattern is tried right where the assertion started.
I am unable to wrap my mind around this sentence. Could
someone give me an example of how this works, and why
it would be useful?
Thanks,
Toby
--
Posted via a free Usenet account from http://www.teranews.com
precedes something else, then you follow the regular expression for
'something' by the regular expression for 'something else' where
`something else` is enclosed by (?=...)
The regular expression engine will surreptitiously check that
'something else' does indeed follow, before returning any match of
'something'.
Unfortunatley the above may be just as hard to decipher as the original
;-)
- Paddy.
.
- Follow-Ups:
- Re: Positive lookahead assertion
- From: tobiah
- Re: Positive lookahead assertion
- From: Neil Cerutti
- Re: Positive lookahead assertion
- References:
- Positive lookahead assertion
- From: tobiah
- Positive lookahead assertion
- Prev by Date: Re: Automate Web Configuration
- Next by Date: Re: Extracting text from a string
- Previous by thread: Re: Positive lookahead assertion
- Next by thread: Re: Positive lookahead assertion
- Index(es):
Relevant Pages
|