Copy link to clipboard
Copied
I'm willing to write a grep code to find my desired words. I'm looking for the word X that there are one or more kinds of spaces before it, or the word X is at the beginning of a paragraph. So far, I wrote this grep code:
([~|~< ]{1,}X)
The problem is I cannot add the ^ --that indicates the beginning of a paragraph to my grep code.
Since I'm writing a grep code, so I cannot add the WholeWord scope to my search, therefore, I wrote {1,} in my code.
Copy link to clipboard
Copied
Hi @SunFlower16, if you are using Find Grep (not ExtendScript) you can use something like
^\s*\K\w+
to find the first word in a paragraph, even if there are spaces before it. Or a specific word "Word":
^\s*\KWord
- Mark
Copy link to clipboard
Copied
Thanks dear Mark.
Your grep code works properly, but it only has one part of my desired function. I'm willing to find the word X whether it is at the beginning of the paragraph or in the middle of a text. Let me clarify
X is a sample sentence.
is X a sample sentence.
In both above sentences, I want to find the word X. Your grep code however only finds the X in the first sentence, not the second sentence.
Copy link to clipboard
Copied
In that case you should be able to use either
\<X\>
or
\bX\b
- Mark
Copy link to clipboard
Copied
I've got another question about FindChangeByList. I want to apply the No Break words, preferably without creating a No Break Character Style prior to applying the change. To elaborate I'm attaching what I want:
I want to find the words X[space]Y and apply No Break to the words X[space]Y. How can I write this on FindChangeByList?
Copy link to clipboard
Copied
Hi Brad, the symbol for a non-breaking space in Indesign's grep is ~S, so
FindWhat: X\sY
ChangeTo: X~SY
- Mark