Copy link to clipboard
Copied
Hello Everyone,
I can't find the text 6954 (The text placed in a table) between these symbol :: :: Please advice or suggest me
Help much appreciated. Thanks in advance.
Code:
main();
function main(doc){
var myDoc = app.activeDocument
app.findGrepPreferences = app.changeGrepPreferences = null
app.findGrepPreferences.findWhat = "\\6954$"
var myFound = myDoc.findGrep();
alert(myFound.length);
}
Yajiv,
just to make sure what kind of special characters you are seeing here execute this line of code:
app.documents[0].xmlViewPreferences.showTagMarkers = true;
The view of the text should go from this:
to about that one:
So we have XML text markers to consider here.
They are encoded in Unicode as FEFF .
Unfortunately InDesign's GREP search is not able to find them with \x{FEFF} .
Text Search is finding them with: <FEFF>
What can we do now? Forget the GREP Search,
hand that task over to TEXT Search:
<FE
...Copy link to clipboard
Copied
Those are index markers.
useful links for your question:
http://indesignsecrets.com/find-out-what-an-index-entry-is.php
http://indesignsecrets.com/free-guide-to-indesign-special-characters.php
xml - Indesign - what does that hidden character mean? - Graphic Design Stack Exchange
InDesign Secrets: Decoding hidden characters
also remove \\ in line 5. try this after removing index markers
app.findGrepPreferences.findWhat = "6954$"
Copy link to clipboard
Copied
"$" in your GREP search stands for "end of the story". So if there are index markers (could be XML tags as well) after your search string then they will not be found.
Thanks Stefan
Copy link to clipboard
Copied
Hi Stefan,
Thanks for your reply.
Could you please explain why the find can't search the text between the index mark or xml tag.
or Is there is any way to find the text?
-yajiv
Copy link to clipboard
Copied
Hi Yajiv,
I am assuming here, that you are not allowed to remove the special characters.
What is the result for the line of code tpkt1982 is offering in answer #1?
Uwe
Copy link to clipboard
Copied
Hi Laubender,
Thanks for the prompt response.
As per TPK instruction, I removed the double slash ("//") and its working fine without index marks.
However I received client file with index mark. Now I need to find the text content between the index marks.
Please advice me how to proceed this..
yajiv
Copy link to clipboard
Copied
Yajiv,
just to make sure what kind of special characters you are seeing here execute this line of code:
app.documents[0].xmlViewPreferences.showTagMarkers = true;
The view of the text should go from this:
to about that one:
So we have XML text markers to consider here.
They are encoded in Unicode as FEFF .
Unfortunately InDesign's GREP search is not able to find them with \x{FEFF} .
Text Search is finding them with: <FEFF>
What can we do now? Forget the GREP Search,
hand that task over to TEXT Search:
<FEFF>6954
I don't know what you like to do with the result.
The result is an array of Texts objects.
Regards,
Uwe
Copy link to clipboard
Copied
Hi Laubender,
Its working like a charm.... Thank so much for your kind support.
@tpk Thank you so much for your help.
-yajiv