Regular Expressions
Contents
Introduction
Here at OmniUpdate our support staff is regularly tasked to manipulate large amounts of text based content. Sometimes requiring us to make similar changes to thousands of HTML pages. In-order to manage that much information we leverage the power of regular expressions to assist us. We've put together this library of our most commonly used Regular Expressions in hopes that you will find them just as useful as we do.
Expressions
<!-- com\.omniupdate\.div.*?-->.*?<!-- /com\.omniupdate\.div -->
This regex pattern combined with the "dot match new lines" feature of PowerGREP can be used to match the editable regions of any tagged page. The characters highlighted in blue instruct the regular expression engine to match any characters found inbetween the text that comes before and after. Enabling this pattern to return every editable region that it finds.
(\A.*)
This nifty little pattern will match the first line of any file. Useful for discovering the header information of a file to determine the type of page (ASP, JSP, PHP, HTML, etc.)
Additional Resources
A few of our favorite sites for information on regular expressions are:
- http://www.regular-expressions.info
- http://en.wikipedia.org/wiki/Regular_expression
- http://regexlib.com
- http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/