Question
regexp quirks
I have:
app.findGrepPreferences.findWhat = "(\\[.*\\])";
and some textFrames with contents like this: [ABCD]
1- My regexp string works but why do I have to put two back slash before square brackets? To me one should be enough to escape the special characters "[" and "]"
2- If I put word boundaries like this:
app.findGrepPreferences.findWhat = "\b(\\[.*\\])\b";
I do not find any occurrance, but in Python it works.
4- In one frame I have something like this:
"This is a test (..some other paragraphs..) string with [ABCD] in it"
This string matches with my "(\\[.*\\])" but when I try:
var myFoundItems = app.documents.item(0).findGrep();
var myword=myFoundItems[0]
I got myword="This".
Any ideas? Thank you
carlo
app.findGrepPreferences.findWhat = "(\\[.*\\])";
and some textFrames with contents like this: [ABCD]
1- My regexp string works but why do I have to put two back slash before square brackets? To me one should be enough to escape the special characters "[" and "]"
2- If I put word boundaries like this:
app.findGrepPreferences.findWhat = "\b(\\[.*\\])\b";
I do not find any occurrance, but in Python it works.
4- In one frame I have something like this:
"This is a test (..some other paragraphs..) string with [ABCD] in it"
This string matches with my "(\\[.*\\])" but when I try:
var myFoundItems = app.documents.item(0).findGrep();
var myword=myFoundItems[0]
I got myword="This".
Any ideas? Thank you
carlo