I'm not very good with regular expressions, but I do know Grep is powerful magic. As part of my exciting weekend I needed to go through a 36K line XML file and change all of the URL's from this format:
To this format where the ending forward slash is replaced by ".html"
BBEdit to the rescue. Not only was BBEdit the only text editor that could open the 254MB file but the Find and Replace tools support regex. The setup is simple:
Notice that the "Replace" function recognizes the Grep tokens for replacement. In this case "\1" is the URL before the last forward slash. It represents the first regex in parentheses. Hitting "Replace" does exactly what I wanted. BBEdit is good stuff.
This does fail if multiple URL's are on the same line. Like I said, I'm not that good with regex.