Reply To: GREP for numeric digits and their corresponding units of measurement

Home Page / Forums / General InDesign Topics (CLOSED) / GREP for numeric digits and their corresponding units of measurement / Reply To: GREP for numeric digits and their corresponding units of measurement

#60240

Well, one one level the combinations are endless — Newton's Gravitational Constant, g, for example, is defined in cubed meters per grams per seconds squared, or m³/gs² — but given a few constraints, you could use the metric system of optional prefix and required unit to your advantage:

d+s?(([pnμmcdkMG]?[gmL])(/([pnμmcdkMG]?[gmL]))*)

This is, from left to right,

any number of digits (but no fractions allowed)

no or only one kind of white space (this was missing in your own attempt)

nothing, or one of the pico, nano, micro, milli, centi, deci, kilo, mega, or giga prefixes

g for grams or L for Liter or m for meter

zero or umpteen of the following group:

{ a slash

followed by (again) a prefix and a unit. }

This misses the minute (min) in your example, but then again that's not an official SI unit :P

This article was last modified on August 8, 2011

Comments (0)

Loading comments...