The “not followed by” operator is as follows: ( per quick reference at http://regexpal.com/ )
?!exprssion
Can I chain these together like this?
?!(?!exprssion)
Why do I ask you ask?
because I need to split() on
|
or
| not follwed by |*
but
| followed by |** is O.K.
See how that is complicated?
Broken Try
.split( /\|\*\*|\|(?!\*)/ );
This does not work because it splits on
|**
and I need my split on
|
Split on this:
This says: either a pipe followed by something not a star (which we will not use to split on), or a pipe followed by 2 stars (use the whole thing to split). I’m not certain from your wording if that’s what you’re looking for. If you mean “split on pipe, unless it’s followed by a single star, but split on a pipe following by 2 stars” then use this:
Demo: http://codepad.org/Gt0xNQNO