You can use regular expressions in Find and Replace. If you want to do it via a command, there’s a scan() method in the TextEditor object that can do the same. If you’re doing major adjustments (it doesn’t sound like you are), you can use TextBuffer's getText() to extract all the text as a string, edit the string, and then replace it with setText().