Status: New
Owner: ----
New issue 1748 by [email protected]: Problem with regex operators ^ and $
http://code.google.com/p/v8/issues/detail?id=1748
I have created a very simple template processor using nodejs but I was
having some unusual difficulties with the `^` and `$` regex operators
(standard RegExp javascript object in V8).
template = template.replace(/(^|[\?][>])([^]*?)($|[<][\?])/g,
function(match, a, b, c) {
For some reason the `^` operator was occasionally matching a second time
near the end of the template string. The only way that I was able to solve
this was with the following hack (avoiding use of `^` and `$`):
template = '<?begin' + template + '<?end';
template = template.replace(/([<][\?]begin|[\?][>])([^]*?)([<][\?])/g,
function(match, a, b, c) {
// other stuff...
});
// Remove <?begin and <?end from script
template = template.substr(7, template.length - 12);
The input template string was 121 lines long with an average line size of
about 50 characters.
I am not sure if this would be an issue with V8 or node.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev