Is there a name for units of measurements that break to a new line and leave behind their number? Let’s call them strays. If strays bug you, GREP is here to help.
1. Establish your character style
2. Creating the basic GREP Style
\d+ “one or more digits”
\x20 “normal space”
(?i) “case insensitive”
3. Adding additional units of measurement
This GREP Style will find a number followed by SF or sf and apply No Break. The next step is to add all of the units that you typically find in your documents. To do this, we wrap all of the units in parentheses and use a pipe to separate them. In my documents, I typically run into SF, Sq. Ft., CY, and Cu. Yd.
\d+\x20(?i)(SF|Sq\. Ft\.|CY|Cu\. Yd\.)
Periods are used by GREP so you must escape them using a backslash in order to represent a regular period. Since we wrap all of the units within parentheses, the (?i) case insensitive apply to all.