Daniel Brylak on the Adobe Forums: Regular Expressions in CS5.5 – something is wrong and limited to CS5+:
Please correct me, but I think, I found a serious problem with regular Expressions in Indesign CS5.5 (and possibly in other apps from CS5.5).
Let’s start with simple example:
————-
var range = "a-a,a,a-a,a";————-
var regEx = /(a+-a+|a+)(,(a+-a+|a+))*/;
alert( "Match:" +regEx.test(range)+"\nLeftContext: "+RegExp.leftContext+"\nRightContext: "+RegExp.rightContext );
What I expected was true match and the left and the right context should be empty. In Indesign CS3 that is correct BUT NOT in CS5.5.
In CS 5.5 it seems that the only first “a-a” is matched and the rest is return as the rightContext – looks like big change (if not parsing error in RegExp engine).
Please correct me if I am wrong.
The second example – how to freeze ID CS5.5:
————-
var range = "a-a,a,a-a,a";var regEx = /(a+-a+|a+)(,(a+-a+|a+)){8,}/;————–
alert( "Match:" +regEx.test(range)+"\nLeftContext: "+RegExp.leftContext+"\nRightContext: "+RegExp.rightContext );
As you can see it differs only with the {8,} part instead of *
Run it in CS5.5 and you will see that the ID hangs (in CS3 of course it runs flawlessly}.
The third example – how to freeze ID 5.5 in one line (I posted it earlier in Photoshop forum because similiar problem was called earlier):
—————
alert((/(n|s)? /gmi).test('s') );
—————As you can guess – it freezes the CS5.5 (CS3 passes the test).
Please correct me if I am doing something wrong or it’s the problem of Adobe.
Best regards,
Daniel Brylak
