Copy link to clipboard
Copied
Hi
Can anyone provide me with the GREP search string that will allow me to quickly find and replace instances of numbers, 01 02 03 04 05 06 07 08 09 with 1 2 3 4 5 6 7 8 9?
Thanks, much appreciated.
Alex
Find
\<(0)(\d)
Replace
$2
This will find any zero followed by any digit at the start of a "word", and replace it with only the digit that follows. It leaves alone any zero in other locations (so a number like 408 or 480 would not be affected)
Copy link to clipboard
Copied
Find
\<(0)(\d)
Replace
$2
This will find any zero followed by any digit at the start of a "word", and replace it with only the digit that follows. It leaves alone any zero in other locations (so a number like 408 or 480 would not be affected)
Copy link to clipboard
Copied
Eureka! this is fantastic, beautiful even. Thanks so much.
Copy link to clipboard
Copied
Yep, but...
[mode nitpick ON]
numbers like 024 or 0357 would also be affected. And so would be 00...
If I read carefully the request, only 01 to 09 should be grabbed.
So... maybe
Find \<(0)([1-9](?!\d))
Replace $2
[mode nitpick OFF]
Copy link to clipboard
Copied
[mode bliss ON]
Copy link to clipboard
Copied
Good point, vinny
I made the (perhaps faulty) assumption that all numbers with leading zeros were to be fixed ( and the double-zero situation didn't occur to me).
Copy link to clipboard
Copied
Good enough! …
(^/)