[Tutor] stopping greedy matches
Mike Hall
michael.hall at critterpixstudios.com
Thu Mar 17 02:45:48 CET 2005
On Mar 16, 2005, at 5:32 PM, Sean Perry wrote:
> I know this does not directly help, but I have never successfully used
> \b in my regexs. I always end up writing something like foo\s+bar or
> something more intense.
I've had luck with the boundary flag in relation to lookbehinds. For
example, if I wanted to only match after "int" (and not "print")
(?<=\bint) seems to work fine. I'm a bit frustrated at not being able
to find a simple way to have a search stop after eating up one word.
You'd think the \b would do it, but nope.
More information about the Tutor
mailing list