At 09:50 11/09/2010 -0700, Rich Shepard wrote:
Apparently I'm not correctly specifying the regex for accomplishing what I need.
It's a bit unfair to keep your current attempts a secret and to expect people to guess where you have gone wrong.
A couple of spreadsheet columns have telephone numbers as a string of 10 digits without separating hyphens.
That's not entirely clear, I'm afraid - and this may be the source of your problem. Do the cells contain these values as numbers or as text which just happens to consist only of digits? If you have perhaps inherited these values from somewhere and are not sure, just go to View | Value Highlighting (or Ctrl+F8); numbers will show in blue and text values in black. (Green means a formula.)
I want to search for ?????????? and replace that with ???-???-???? for the entire column. However, I'm told that the search string is not found.
o If your values are numbers, you can display them in the way you wish simply using the formatting of the cells. Use 000-000-0000 . o If your values are numbers and you want the result as text, you could use a formula such as =INT(A1/10000000)&"-"&TEXT(MOD(INT(A1/10000);1000);"000")&"-"&TEXT(MOD(A1;10000);"0000") . You can copy the results back into the original column as values instead of formulae using Paste Special, of course. But keep reading for an easier solution.
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?
o Search for (.{3})(.{3})(.{4}) and replace with $1-$2-$3 . ".{3}" means any three characters and so on. The parentheses then define the sections as references, and these can then be referred to in the "Replace with" field as $1 and so on. This works whether your values are numbers or text, creating text values as the results.
If your cells contain material additional to the telephone numbers themselves - even just leading or trailing blanks - the problem may become more complicated. You may need to use [:digit:] instead of the dots in the search pattern.
I trust this helps. Brian Barker --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@openoffice.org For additional commands, e-mail: users-h...@openoffice.org