Saturday, February 03, 2007

Open Office and regular expressions

For the first time in my life, I tried to use Open Office for more than 15 minutes. While converting data from an HTML page into a chart I noticed that regular expressions don't seem to work in the Replace part of the Find/Replace dialog.

This must be a joke. My problem is trivial: Convert "8.1 k" into "8100" and "9k into 9000". I can't do it the straightforward way with 2 regular expressions. On an ideological level I'm a big supporter of Open Office, but today all I see is that it's wasting my time. (The corresponding online help for the dialog is not very useful either.)

4 comments:

Andrew Z said...

It's not fair to tag this post a bug based on the inform you provide. Frustrating, yes. Bug, no.

For example, based on the limited information you provided, you can accomplish your goal by searching for "8.1 k" and replacing it with "8100". Regex not required?

Do you have a lot of them? You didn't say that. Are they all in the "#.# k" format?

nyenyec said...

Hi Andrew. I was trying to convert a bunch of tables like this one:
http://stats.wikimedia.org/EN/TablesWikipediaSV.htm
into proper numbers for further calculations.

Andrew Z said...

Nyenyec, I know many months have passed since your original post, but I hope you find my solution helpful.

If you have any troubles, let me know.

Andrew

nyenyec said...

Andrew, thanks for the tip.

It would be great if this was properly documented in the online help.

Cheers.

nyenyec