-
1. Re: GREP to Seperate Number from SI Unit
[Jongware] Sep 22, 2011 8:30 AM (in response to RichardM0701)Find
(\d)([\u\l])
and change to
$1 $2
-- the parenthesized elements in the Find define "marked subexpressions" which can be recalled in the Change field using the enumerated Found Text codes.
-
2. Re: GREP to Seperate Number from SI Unit
RichardM0701 Sep 22, 2011 8:43 AM (in response to [Jongware])Thanks Jongware! Works as advertised You just saved me a whole day of formatting. Thank you!
-
3. Re: GREP to Seperate Number from SI Unit
IDV-Thill Jan 3, 2012 11:01 PM (in response to [Jongware])Hi,
Thanks for this useful and timesaving information.
Will
Find (\d)\s?([\l\u])
replace with $1~S$2
work ?
I think it have to be a non-breakable space between the number and the SI unit, so the number never will loose his unit.
-
4. Re: GREP to Seperate Number from SI Unit
[Jongware] Jan 4, 2012 1:44 AM (in response to IDV-Thill)Yes, but you need to be careful with the '\s' (Any Whitespace) wildcard. Hard returns and tabs, for instance, are also considered 'any whitespace'!
It might be safer to use a regular space here:
(\d) ?([\l\u])
because this will only find occurrences without a space, due to the '?', or with a regular space -- and those are the ones you want to change.
-
5. Re: GREP to Seperate Number from SI Unit
IDV-Thill Jan 5, 2012 4:30 AM (in response to [Jongware])Thanks for those precisions. I've seen that the "find" statements "take" the numbers followed by a text !
Do you think it's possible to restrict for some fixed units "c|k|hm" for cm, km, hm, ... in the search part?
-
6. Re: GREP to Seperate Number from SI Unit
[Jongware] Jan 5, 2012 5:05 AM (in response to IDV-Thill)Absolutely, GREP indeed uses the vertical bar as an OR separator:
(\d) ?(c|k|h) (-- etc.)
For a longer version, check out GREP for numeric digits and their corresponding units of measurement.



