Reputation: 295
I have a long list of words in a indesign file, one word per line. Like so: "Snake Bottle Cloth Tonic Ruler Pothole Congress"
I want to extract all words that contain the, say letter "n".
Please help. Thanks.
Upvotes: 0
Views: 213
Reputation: 14537
If you really want to extract the 'n'-words from a list of words I'd propose this GREP:
Find what: \b[^n]+\b
Change to: \n
The \b
means an edge of the word. And the whole expression can be translated as: find any number of characters but 'n' within the word boundaries and change it to a break line.
If there could be a uppercase 'N' you can handle it with this modification:
Find what: \b[^N|^n]+\b
Upvotes: 0
Reputation: 6418
The following regex should do what you want:
(\w+)?n(\w+)?
See here: https://regex101.com/r/6d5q9m/1
Upvotes: 0