Gedit regular expressions plugin: Difference between revisions
From WickyWiki
| Line 13: | Line 13: | ||
== Examples == | == Examples == | ||
=== Replace trailing whitespaces and /r with /n === | === Replace trailing whitespaces and /r with /n === | ||
Search: | Search: | ||
[ \t\r\n]{1,9} | |||
Replace with: | Replace with: | ||
\n | |||
=== Split word with capital letter in the middle === | === Split word with capital letter in the middle === | ||
Search: | Search: | ||
([a-z,.])([A-Z]) | |||
Replace with: | Replace with: | ||
\1 \2 | |||
=== Search 1 (one) in a non-number === | === Search 1 (one) in a non-number === | ||
Search: | Search: | ||
[^0-9]1[^0-9] | |||
=== Search number > 9 === | === Search number > 9 === | ||
| Line 44: | Line 43: | ||
Search: | Search: | ||
([a-z])-\n{1,9}([a-z]) | |||
Replace with: | Replace with: | ||
\1\2 | |||
=== Remove EOL: trailing and leading non-capital letter === | === Remove EOL: trailing and leading non-capital letter === | ||
Search: | Search: | ||
([a-z,;:])[ \n]{1,9}([a-z]) | |||
Replace with: | Replace with: | ||
\1 \2 | |||
=== Remove EOL: leading non-capital letter === | === Remove EOL: leading non-capital letter === | ||
Search: | Search: | ||
\n{1,9}([a-z]) | |||
Replace with: | Replace with ('_' should be a space): | ||
_\1 | |||
=== Remove EOL: trailing non-capital letter=== | === Remove EOL: trailing non-capital letter=== | ||
([a-z,;:])\n{1,9} | |||
\ | Search: | ||
([a-z,;:])\n{1,9} | |||
Replace with ('_' should be a space): | |||
\1_ | |||
== Regular expressions in Office Libre == | == Regular expressions in Office Libre == | ||
Revision as of 18:20, 16 November 2011
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
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 ('_' should be a space):
_\1
Remove EOL: trailing non-capital letter
Search:
([a-z,;:])\n{1,9}
Replace with ('_' should be a space):
\1_
Regular expressions in Office Libre
You can also use regular expressions in Office Libre.
Remove paragraph trailing space
Search:
'^(.*) $'
Replace with:
'$1'