Archives


The views expressed on this website/weblog are mine alone and do not necessarily reflect the views of my employer.

Openoffice.org Calc - Find & Replace Issue Solved

Today, we were trying to write instructions for users to download some report data and combine it into a spreadsheet for analysis. It required searching and replacing certain strings of text. For example, we needed a Find & Replace function to find the following examples and replace them with nothing:

(5)

(55)

(47)

The numbers in parentheses could be anything. We found that in Excel, we could simply search for ‘(*)‘ and replace with nothing. But In OOo, that didn’t work. After struggling with it for a while, we realized OOo is more particular about using Regular Expressions and the use of the wild card was different. After quite of bit of searching on the internet, we figured out that the following string worked in the Find field:

\([0-9]+\)

You also had to specify “Regular Expressions” in the expanded “More” section of the Find & Replace dialog. The string works like this:

\( = makes OOo treat the ‘(‘ like a character and not a function.

[0-9]+ = specifies a search for a numeric character. The ‘+’ lets it match any number of characters together.

\) = makes OOo treat the ‘)’ like a character and not a function.

I doubt anyone else cares much, but now when I need this a few months down the road, I know where to find it. :-)

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>