Den 2010-09-11 18:50:30 skrev Rich Shepard <[email protected]>:
Apparently I'm not correctly specifying the regex for accomplishing
what I
need.
A couple of spreadsheet columns have telephone numbers as a string of
10
digits without separating hyphens. I want to search for ?????????? and
replace that with ???-???-???? for the entire column. However, I'm told
that
the search string is not found.
How should I specify a string of 10 digits in the search field and
then
separate them into area code-prefix-number in the replace field?
Rich
First of all, why don't ju just format the cells instead?
Right click the whole cell range → Format cells…
Then, in the format code field in the first tab, type: 000-000-0000
Now all your cells in that range should look like the pattern you
described.
If you really want to search end replace, you need to take a look at the
help section. Search for "regular expressions" or something like that.
First click ”More options” and make sure ”Regular expressions” are
checked. Or something like that; I have the Swedish version so I am not
sure I translate correctly.
Now, in the search field: ([:digit:]{3})([:digit:]{3})([:digit:]{4})
And, in the replace field: $1-$2-$3
I tested this myself and it works. If the first position can be 0, then
make sure the cells are formatted as text.
Still, I think formatting is much nicer, and I can't see why search and
replace would be preferred in this case.
--
Kind regards
Johnny Rosenberg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]