gedit regex howto

Asked by Tamas

Hello,

I got the gedit regex plugin with replace function from here: http://rafaelsilva.net/node/103

It's great but I have one problem: "^" doesn't work as usual in regex to match the beginning of the line. The same is true for "$" as the end of the line. "^" mathces the beginning of the first line, "$" matches the end of the last line in the text. It's probably because the whole text is interpreted as one long line containing "\n"s marking newlines.

It's easy to find the ends of the lines by searching for "\n"s but I couldn't find similar for the beginning of the lines.

Any suggestions?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gedit Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Peter Cruickshank (petercruickshank) said :
#1

If what you say is true, doesn't that mean "\n" is not only a marker of the ends of lines, but also of the beginnings too?

Revision history for this message
KvYOc4QT8EtW0RE (slurryjazz) said :
#2

http://live.gnome.org/Gedit/Plugins
Regex Search & Replace
      For search and replace in documents using regular expressions.
         Download : http://vaem.googlecode.com/files/gedit2_regex_replace_plugin.tar.gz
      If you just want to search text in documents using regular expressions (regex).
          Download: http://tapioca-voip.sourceforge.net/regexsearch_gedit_plugin.tar.gz

Regex Search Files
      Search text in files using regular expressions (regex).
          Download: http://int.ractable.com/gedit-plugins/regexpsearchfiles-0.2.1.zip
       or for older Gedit that doesn't use GtkSourceView2
                    http://int.ractable.com/gedit-plugins/regexpsearchfiles-0.2.zip
~~~~~~~~~~~
http://halfhourhacks.blogspot.com/2008/03/gedit-regular-expression-plugin.html
                 http://students.olin.edu/2010/bfisher/blog/geditplugin/regex_replace.tar.gz

Can you help with this problem?

Provide an answer of your own, or ask Tamas for more information if necessary.

To post a message you must log in.