MoizNgp
MoizNgp

Reputation: 295

Extract whole word in indesign with grep

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

Answers (2)

Yuri Khristich
Yuri Khristich

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

enter image description here

Upvotes: 0

cybernetic.nomad
cybernetic.nomad

Reputation: 6418

The following regex should do what you want:

(\w+)?n(\w+)?

See here: https://regex101.com/r/6d5q9m/1

Upvotes: 0

Related Questions