Reply To: GREP with hyphens with various numbers

Home Page / Forums / General InDesign Topics (CLOSED) / GREP with hyphens with various numbers / Reply To: GREP with hyphens with various numbers

#52156
Anonymous
Inactive

(sorry for all the edits, i can't get a backslash (reverse solidus) to show up in the text, even when I put in the html code… everywhere you see the letter “d+” insert backslash before it)

Ok this should work

Find

(d+).+?(d+).?mm

Change To

$1-$2mm

Explanation:

d+ is any amount of digits in a row

. is to find any character, and

+? is to find the shortest match

d+ finds any amount of digits in a row again

.? will find any character zero or once only, and

mm is simply the text you have “mm”

(d+).+?(d+).?mm

Anything that is in brackets (parenthesis) are marked as “found”

$1 and $2 are to use the “found” text and insert it

$1-$2 is to put a hyphen between the found text

and mm at the end is to mark it as mm

So find

(d+).+?(d+).?mm

Change to

$1-$2mm

Should find any instance of digits with any characters inbetween them once it's followed by mm.

This article was last modified on March 15, 2010

Comments (0)

Loading comments...