Gedit regular expressions plugin: Difference between revisions
From WickyWiki
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
== Install == | == Install == | ||
# download the plugin from https://bitbucket.org/brandizzi/gedit-re-search/wiki/Home | # download the cortrect plugin from https://bitbucket.org/brandizzi/gedit-re-search/wiki/Home | ||
# extract the contents to | # extract the contents to gedit plugin directory, typically: | ||
#* | #* ~/.gnome2/gedit/plugins (gedit2) | ||
#* ~/.local/share/gedit/plugins (gedit3) | |||
# restart gedit | # restart gedit | ||
# in the menu: Edit -> Preferences -> plugins -> enable | # in the menu: Edit -> Preferences -> plugins -> enable 'RegEx Search and Replace' | ||
# now you should have a | # now you should have a 'Regular Expression..' -item in the Search menu. | ||
== Other gedit plugins == | == Other gedit plugins == | ||
Revision as of 10:53, 9 December 2012
Install
- download the cortrect plugin from https://bitbucket.org/brandizzi/gedit-re-search/wiki/Home
- extract the contents to gedit plugin directory, typically:
- ~/.gnome2/gedit/plugins (gedit2)
- ~/.local/share/gedit/plugins (gedit3)
- restart gedit
- in the menu: Edit -> Preferences -> plugins -> enable 'RegEx Search and Replace'
- now you should have a 'Regular Expression..' -item in the Search menu.
Other gedit plugins
Examples
Note: where needed an underscore (_) is used to denote a space.
Replace /r/n with /n
| Search | Replace with |
|---|---|
| \r\n | \n |
Check:
| Search |
|---|
| \r |
Remove trailing white-spaces
| Search | Replace with |
|---|---|
| [ \t]{1,9}\n | \n |
Split word with capital letter in the middle
| Search | Replace with |
|---|---|
| ([a-z,.])([A-Z]) | \1 \2 |
Replace 1 (one) in a non-number with I
| Search | Replace with |
|---|---|
| [^0-9]1[^0-9] | I |
Search number > 9
| Search |
|---|
| [0-9]{2,9} |
Remove hyphenation '-' from words
| Search | Replace with |
|---|---|
| ([a-z])-\n{1,9}([a-z]) | \1\2 |
Remove EOL: trailing and leading non-capital letter
| Search | Replace with |
|---|---|
| ([a-z,;:])\n{1,9}([a-z]) | \1 \2 |
Remove EOL: leading non-capital letter
| Search | Replace with |
|---|---|
| \n{1,9}([a-z]) | _\1 |
Remove EOL: trailing non-capital letter
| Search | Replace with |
|---|---|
| ([a-z,;:])\n{1,9} | \1_ |
Regular expressions in Office Libre
You can also use regular expressions in Office Libre. Note that variables are noted with a '$'.
Remove paragraph trailing spaces
| Search | Replace with |
|---|---|
| ^(.*) {1,9}$ | $1 |