Regex in EditPad Pro – finding the beginning or end of a file

I quite often need to ‘wrap’ a text file in the <xml></xml> tags when converting a plain text file in to XML, so that the file is a valid XML document.

Using EditPad Pro with regex makes this straightforward.

\A finds the beginning of a file

\z finds the end of a file

So, with Regex turned on use the following Search and Replace:

\A –> <xml>

\z –> </xml>

This entry was posted in HTML & XML, Regular Expressions (RegEx). Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.