I’m using Geany for much of the editing I do beside using vim. Search and replace is an important feature even in its simple forms, but combining it with regular expressions makes it much more powerful.

I had a HTML document that used id attributes to assign anchors. It seems that that is old-school and one should use the name-attribte instead. However there were mechanics working on that ids that I didn’t want to touch, so I actually didn’t want to replace them, but add to them. Turns out that works fine with an according expression.

I ended up searching for id="(.*) and replacing that with id="\1"><a name="\1"></a> after having turned on the regular expression matching in the search dialogue. The () defines the match-area and \1 is then the reference to that match in the replace-string. That kept the existing id-attributes intact and added an empty anchor behind them, that I could use to navigate within the sites.