Gedit regular expressions plugin
From WickyWiki
Install
- download the plugin from http://halfhourhacks.blogspot.com/2008/03/gedit-regular-expression-plugin.html
- extract the contents to ~/.gnome2/gedit/plugins/ you will have these files:
- ~/.gnome2/gedit/plugins/regex_replace.gedit-plugin
- ~/.gnome2/gedit/plugins/regex_replace.gedit-plugin/regex_replace
- restart gedit
- in the menu: Edit -> Preferences -> plugins -> enable Expression Replace
- now you should have a "Regular Expression" item in the Search menu.
Other gedit plugins
Examples
Note: use the example strings without the quotes.
Replace trailing whitespaces and /r with /n
Search:
'[ \t\r\n]{1,9}'
Replace with:
'\n'
Split word with capital letter in the middle
Search:
'([a-z,.])([A-Z])'
Replace with:
'\1 \2'
Search 1 (one) in a non-number
Search:
'[^0-9]1[^0-9]'
Search number > 9
Search:
'[0-9]{2,3}\n{2,3}'
Remove '-' in words
Search:
'([a-z])-\n{1,9}([a-z])'
Replace with:
'\1\2'
Remove EOL: trailing and leading non-capital letter
Search:
'([a-z,;:])[ \n]{1,9}([a-z])'
Replace with:
'\1 \2'
Remove EOL: leading non-capital letter
Search:
'\n{1,9}([a-z])'
Replace with:
' \1'
Remove EOL: trailing non-capital letter
([a-z,;:])\n{1,9} \1
Regular expressions in Office Libre
You can also use regular expressions in Office Libre.
Remove paragraph trailing space
Search:
'^(.*) $'
Replace with:
'$1'