Regex help!

Associate
Joined
6 Nov 2003
Posts
2,138
Location
West London
Hi folks, I'm trying to parse some Wiki style markup to generate some html but regex is not my strong point.
I'm trying to replace markup such as this:

PHP:
<< content_here <<

into this:

PHP:
<div>content_here</div>

The parser I'm using (Javascript Creole 1.0 Wiki Parser) uses regex to match all other markup so I'm trying to follow the same format using this expression:

PHP:
/<<([^*~]*((<(?!<)|~(.|(?=\n)|$))[^*~]*)*)(<<|\n|$)/
Which doesn't quite do the job - it appears to be generating a div block for each "<<" instead of "<<blahblah<<"

Basically, I need the expression to match << followed by anything at all, until it hits the next <<

Anyone able to help?
 
Back
Top Bottom