[thelist] Regex help

Matt Warden mwarden at gmail.com
Wed May 2 15:49:38 CDT 2007


On 5/2/07, Tab Alleman <talleman at lumpsum.com> wrote:
> Been trying to figure this out, but I haven't found a way to do what I want in any of the tutorials out there.
>
> Say I've got a string like this:
>
> any combination of characters + "START" + any combination of characters except START + "START" + any combination of characters except START + "END" + any combination...
>
>
>
> I want to create a regex that will grab the chunk of the string between the SECOND "START" and the next "END".  The pattern I created grabs from the FIRST "START" to the first "END":
>

Not all that confident in this syntax because I haven't had to "not" a
word before, but...

^(START)*START(^(START)+)START^(START)+END.*

I'm not sure that's how to "not" a string, so you'll need to look that
up. But that's the idea. The first (possibly second if the first set
of parens is considered a grouping) match in the returned matches
should be the value you want.

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.



More information about the thelist mailing list