[3.5.1.2/Calc/XP] Regex to find/replace numbers?

Hello

I need to search and reformat toll-free numbers in a spreadsheet, but I
can't find how to do this in Calc:

" (\d\d)(\d\d)(\d\d)"

ie. space + six digits in pairs.

In the "Find & Replace" dialog, even with the default "Regular expression"
option checked and "Search in=Values", this triggers "Search key not found".

Thank you.

Hi,

I need to search and reformat toll-free numbers in a spreadsheet, but I
can't find how to do this in Calc:

Sorry, could you elaborate a bit, what you mean by toll-free numbers? Some
examples?

" (\d\d)(\d\d)(\d\d)"

This regex will find text like " 123456", not numbers (as numbers are numbers
and do not contain blanks)

ie. space + six digits in pairs.

what do you mean by "pairs"? The above regex does not find any kind of
"pairs".

So, I'm a bit clueless, what you want to search really.

Nino

Sorry, as I'm working with text mostly, I've overseen that \d is not the
correct syntax for digits. Pressing Help (or F1) in the search dialog, you'll
find a link to the List of Regular Expressions. There you can see, that a
digit is represented by [:digit:], not by \d. So you might have to search for
" ([:digit:]{2}.){2}[:digit:]{2}" or similar (without the double quotes).

Nino

Hi. Is the object to then paste the new number from $1 $2 $3 to get the new formatting? Is there always white space at the front

"\s(\d\d)(\d\d)(\d\d)"
steve

Am 02.05.2012 20:03, Steve Edmonds wrote:

Hi. Is the object to then paste the new number from $1 $2 $3 to get the
new formatting? Is there always white space at the front

"\s(\d\d)(\d\d)(\d\d)"
steve

Nope. You should really start the software and try before posting. Perl regexes are not supported at all.

Thanks for correcting me, I had only briefly looked at regex previously then achieved what I needed another way without regex.

Hi. Do you know if you can use the find text in the replace field as in perl.
Search for ([:digit:]){2}\/ ([:digit:]){2}\/([:digit:]){4}
Replace with $3-$1-$2

Do not understand the logic to search for numbers as pairs, but the
syntax to use is '[:digit:]'. It may be quicker and easier to use
regular expressions within a text editor and then import the
information into the spreadsheet.

It looks like AOO3.4 will support ICU regexp, so \s(\d\d)(\d\d)(\d\d) would become valid and replacement with $n values possible. Means I can search and replace dates changing format. Especially useful in writer.
Cheers, Steve

Sure you can.

F1 (Help) in the Search dialog points you to the list of regex'es.

Nino

Am 03.05.2012 12:38, Steve Edmonds wrote:

It looks like AOO3.4 will support ICU regexp, so \s(\d\d)(\d\d)(\d\d)
would become valid and replacement with $n values possible. Means I can
search and replace dates changing format. Especially useful in writer.
Cheers, Steve

Dates can be set in table cells and in fields. Both elements are formattable.

Am 03.05.2012 12:38, Steve Edmonds wrote:

It looks like AOO3.4 will support ICU regexp, so \s(\d\d)(\d\d)(\d\d)
would become valid and replacement with $n values possible. Means I can
search and replace dates changing format. Especially useful in writer.
Cheers, Steve

Once again: Nope.
They changed the regex engine but a digit is still matched by [:digit:].

Thanks everyone for the help.