Hi all-
Stumped over the following regex for a block comment:
begin = '(?<=0 : 0$)';
This actually works, but I need to generalize it to one or more whitespace characters between the "0" and ":", and then between the colon and final zero.
Tried things like:
begin = '(?<=0\s+:\s+0$)';
but Oniguruma gets really irked at me.
Grateful for any thoughts or pointers...
Thanks, Charles
On Jan 24, 2011, at 6:51 PM, Charles Turner wrote:
Tried things like:
begin = '(?<=0\s+:\s+0$)';
"Subexp of look-behind must be fixed character length. But different character length is allowed in top level alternatives only. ex. (?<=a|bc) is OK. (?<=aaa(?:b|cd)) is not allowed."
C.
On 25 Jan 2011, at 00:51, Charles Turner wrote:
Stumped over the following regex for a block comment:
begin = '(?<=0 : 0$)';
This actually works, but I need to generalize it to one or more whitespace characters between the "0" and ":", and then between the colon and final zero.
Can you quote the rule for block comments?
Look-behind is generally a bad thing to use in grammars, so I would suggest you revise your approach. Normally this is done by matching the stuff leading up to the block comment (setting the right context).
On Jan 30, 2011, at 6:42 AM, Allan Odgaard wrote:
Look-behind is generally a bad thing to use in grammars, so I would suggest you revise your approach. Normally this is done by matching the stuff leading up to the block comment (setting the right context).
Hi Allan-
Thanks very much for the response. I came to pretty much the same conclusion, although not specifically about the badness of look-behinds.
Best wishes, Charles