RegEx Advanced : Positive lookbehind

Posted by mpneuried on Stack Overflow See other posts from Stack Overflow or by mpneuried
Published on 2010-04-21T14:06:32Z Indexed on 2010/04/21 14:13 UTC
Read the original article Hit count: 292

Filed under:
|
|

This is my test-string:

<img rel="{objectid:498,newobject:1,fileid:338}" width="80" height="60" align="left" src="../../../../files/jpg1/Desert1.jpg" alt="" />

I want to get each of the JSON formed Elements inbetween the rel attribute. It's working for the first element (objectid).

Here is my ReqEx, which works fine:

(?<=(rel="\{objectid:))\d+(?=[,|\}])

But i want to do somthing like this, which doesn't work:

(?<=(rel="\{.*objectid:))\d+(?=[,|\}])

So i can parse every element of the search string.

I'm using Java-ReqEx

© Stack Overflow or respective owner

Related posts about regex

Related posts about lookbehind