regex question

Mark Greenberg markgreenberg at cox.net
Thu Dec 1 17:59:54 EST 2005


+?

or in your case

"(?s)<B>(.+?)</B>"

Hope this helps.

	Mark

On Dec 1, 2005, at 2:07 PM, Mark Wieder wrote:

> All-
>
> Is there a way to tell matchChunk() not to be greedy?
>
> I've got a regular expression stumper here. I'm using regex with the
> matchChunk() function and I've BZed a problem with it. Now I'm looking
> for a workaround that still manages to use matchChunk().
>
> MatchChunk() is apparently implementing regex's "greedy" mode, so a
> call to matchChunk() returns everything between the first <B> tag and
> the *last* </B> tag. So...
>
> put "<B>hello, bucko</B> this is a <B>test</B>"
> matchChunk(tRawText, "(?s)<B>(.+)</B>", tPos, tEnd)
>
> returns "hello, bucko</B> this is a <B>test"
>
> What I'd like to return is just "hello, bucko". Is there some regex
> incantation that will do this for me? I can't seem to come up with it.




More information about the use-livecode mailing list