At 22:45 08/12/2007 -0800, Henry Ballard wrote:
I am using openoffice 2.3 - just downloaded it and installed it this week.

In calc, I was trying to search for something more than a simple string - looking at the documentation of the regular expressions "supported", I found that searching for "M" was fine but "[M]" is not found - it says #value (???). Then I tried =SEARCH("M|I";"Misty")
 and that doesn't work either. Then I tried
=SEARCH("[:alnum:]";"Misty")
with no different luck. So far, I'm wondering if any regular expressions work. Or maybe there's some trick. Or the documentation is misleading.

You can turn on or off the evaluation of regular expressions. This is useful, since it means that you don't have to know about or be constantly aware of regular expressions if you are not using them - as you would otherwise have to. You probably know that in order to use regular expressions in the Find & Replace dialogue, you need to tick the "Regular expressions" box there. But you are using a regular expression in a formula - in this case, in the SEARCH function. To enable regular expressions in formulae, go to Tools | Options... | OpenOffice.org Calc | Calculate and tick "Enable regular expressions in formulas". (The help text for the SEARCH function does mention this, in fact.)

All your examples then work, except for the last. Items such as [:alnum:] seem to work in regular expressions only when they are qualified to indicate how many such characters you wish to match. So you need to use
     =SEARCH("[:alnum:]?";"Misty")
or
     =SEARCH("[:alnum:]*";"Misty")
instead.

I trust this helps.

Brian Barker


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to