Ask Your Question

Why does this regular expression work in Regex Tester but not in LibreOffice Find and Replace? [closed]

asked 2014-06-24 22:11:54 +0100

Fogest gravatar image

updated 2020-08-16 12:44:50 +0100

Alex Kemp gravatar image

I am using the following regular expression:


On Regexpal my regex does what it is suppose to, however on LibreOffice is doesn't.

The Regex above should match the following sample cases:


It however should not match cases where the is text following the "cs" part. The Regex I created above according to RegexPal works, however in LibreOffice nothing is found. Here is an example of a case that should not be matched:


Am I doing something wrong here?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-26 09:55:27.602927

1 Answer

Sort by » oldest newest most voted

answered 2014-06-24 23:17:25 +0100

David gravatar image

updated 2014-06-24 23:25:08 +0100

The LibreOffice/OpenOffice "flavour" of regex doesn't know your \s, as you have discovered. According to

\s stands for "whitespace character". Again, which characters this actually includes, depends on the regex flavor. In all flavors discussed in this tutorial, it includes [ \t\r\n\f]. That is: \s matches a space, a tab, a line break, or a form feed.

If that is indeed what you want, you'll need to use this for your LibO Calc (or Writer) regex:


At least in my little test it seemed to behave the way you want. Further on LibO/OO regex:


edit flag offensive delete link more


I am just going for an effect where it only selects entries matching the beginning case and NOTHING after the "cs" part. Some rows I have include something like or something along this things which I do not want to return as matches. They must specifically end with a "cs"

Fogest gravatar imageFogest ( 2014-06-25 01:39:47 +0100 )edit

So ... did the solution I suggested work for you? or no? You could also try .*@cs(?!.), using a negative lookahead which appears to be supported, but it will not find "text@cs", i.e., "cs" followed by a space.

David gravatar imageDavid ( 2014-06-25 09:32:27 +0100 )edit

Question Tools



Asked: 2014-06-24 22:11:54 +0100

Seen: 1,141 times

Last updated: Jun 24 '14