Regex in LibreOffice
Posted 05-24-2016 at 05:06 AM by HMW
Although I prefer to work with text in editors, and not in word processors, I sometimes have to. Today I faced a massive editing task in a formatted .rtf document. I had to iron out some "bugs" in the text. Such as no space after a dot:
FOOBAR.Foobar.
Now, going through this massive text and look for these occurances manually clearly wasn't an option. I'd rather eat a cactus. Had it been "normal" - not formatted - text, I could have used regular expressions in Vim, or Sed or whatever tool. But since I could not "un format" the text it was a no-go.
Then I found that you could actually use regular expressions in LibreOffice. The syntax is a little different than in Sed for instance, but the differences are well documented here.
So, instead of doing this in Sed:
We do this in LibreOffice:
As you see, not all too different. This (and other) use of regular expressions saved me (and my employer) literally hours of work.
So, thank you LibreOffice, I will be kinder towards you in the future!
FOOBAR.Foobar.
Now, going through this massive text and look for these occurances manually clearly wasn't an option. I'd rather eat a cactus. Had it been "normal" - not formatted - text, I could have used regular expressions in Vim, or Sed or whatever tool. But since I could not "un format" the text it was a no-go.
Then I found that you could actually use regular expressions in LibreOffice. The syntax is a little different than in Sed for instance, but the differences are well documented here.
So, instead of doing this in Sed:
Code:
's/\.\([A-Z]\)/. \1/'
Code:
[Search for] \.([A-Z]) [Replace with] . $1
So, thank you LibreOffice, I will be kinder towards you in the future!
Total Comments 0