0

Say I want to remove all digits from a text file using

  • gedit 3.10.4
  • advanced_find 3.6.0

I have selected the Advanced Find/Replace plugin to support regular expressions out of an internet search. It seemed to stand out for simplicity, accessibility and users' endorsements. The version is claimed to be suitable for gedit 3.8 and later.

The plugin has been successfully installed and activated in the Edit>Preferences>Plugin list. However, if I launch a regex substitution query for the object [:digit:], I get the message

"[:digit:]" not found

while there are digits aplenty. The same occurs for little variations like [:digit:]* or ([:digit:]*)

enter image description here

Strangely, if I do precisely the same on the same document with LibreOffice Writer, the commands are executed flawlessly.

What is the problem with gedit here? Is there a compatibility issue between host application and plugin? Need regular expression be typed in gedit according to specific rules? Did I miss anything obvious?

Help to get the same capabilities with gedit as with LibreOffice Writer much appreciated.

  • 1
    I'm not aware that [:digit:] is a regex. I always thought that \d was a digit. – Digisec Jan 4 '16 at 13:34
  • 2
    [:digit:] is a character class. You use character classes within a bracket expression, so you'd want [[:digit:]]. I would have expected gedit to treat [:digit:] as the bracket expression containing the set of characters :,d,g,i,t – glenn jackman Jan 4 '16 at 14:09
  • Both comments above are an answer to the question: both \d and [[:digit:]] do the job. They also clarify my perplexity. LibreOffice lexical flexibility made me believe that regular expressions are represented/handled uniformly all over across editing applications. – XavierStuvw Jan 4 '16 at 18:01
  • As @Digisec and @'glenn jackman' convert their comments to answers, I will be pleased to mark them as answers. – XavierStuvw Jan 10 '16 at 12:55
1

I am not fully aware of LibreOffice's internal syntax, but if you are talking about regex, as in regular expressions, you will have to use the digit symbol \d.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.