Replace regular spaces before units with non-breaking spaces
Hi,
For all who have similar needs and who might find this helpful. I know that you could also combine this in an ExtendScript script, but for now this is just a short hack.
Usually I enter non-breaking spaces before units. However, sometimes there are regular spaces.
And when I get translations back, the translators often ignore this as well. Therefore here a regular expression to find numbers with units with no or regular spaces. Of course you can adapt this to your needs.
And do not forget to select Regular Expressions in the Find/Replace dialog.
I closed all units with \b, although this is definitely not needed for all.
Find:
(\d) *(%\b|(°C)\b|(µm)\b|A\b|(Ah)\b|(bps)\b|(Byte)\b|(Bytes)\b|(cm)\b|(dB)\b|g\b|(GB)\b|(hours)\b|(Hz)\b|(Jahre)\b|(kA)\b|(kB)\b|(kbps)\b|(kg)\b|(kHz)\b|(km)\b|(kOhm)\b|(kV)\b|(kW)\b|(kΩ)\b|m\b|(mA)\b|(mAh)\b|(MB)\b|(MHz)\b|(Minuten)\b|(minutes)\b|(mm)\b|(mT)\b|(mTesla)\b|(mV)\b|(mW)\b|(MW)\b|(Ohm)\b|(Pixel)\b|(pixel)\b|s\b|(sec.)\b|(Sek.)\b|(Stunden)\b|V\b|W\b|(years)\b|Ω\b)Replace:
$1\ $2And I have also RS-485 or RS-232, where I want non-breaking hyphens. I replaced with \+ which works for Replace, but not for Find. For Find you have to use \x15 from the Windows character set (in the online help in the appendix).
Find:
(RS)[ -]?(\d)Replace:
$1\+$2And I have RJ45 or RJ12, where I do not want any spaces or hyphens.
Find:
(RJ)( |-|\x15)?(\d)Replace:
$1$3Best regards, Winfried

