Last week I wrote a simple gedit plugin and so learned about the API and how to manipulate text in the editor. Even once I had learned about the API it still seemed far to complex to be usefull for quick data manipulation of an open file, so I decided to make a simple script that made things simpler, and makes the gedit Python console do what I wanted all along.
Save this script as ~/.gnome2/gedit/plugins/doc.py
Now open up the Python console in gedit and type import doc
d = doc.Doc(window)
d.set_lines( ['one', 'two', 'three'] )
lines = d.get_lines()
Now you can use regular expressions on you're open documents :)