Regular Expressions

This is really just some rough notes but is a starting point to something more... >

There is a rather good background, history and explanation of Regular Expressions on Wikipedia, see Regular expression - Wikipedia.

Regular Expression What it does
^(line)[0-9]+\: Matches lines starting “Line23:”, it looks for the word line at the start of the line and then any number of digits followed by a colon
^(Found).+$ Match lines starting “Found” and then having any number of any characters after that to the end of the line
(<)[^>]*(>) Match a “<” followed by any number of characters that are not “>” and then also match the closing “>”. This has the effect of removing all xml tags, opening and closing.
(\[|\()([a-z]|[A-Z])(\]|\)) Searches for an upper or lower case letter in round brackets ( ) or square brackets [ ]
[a-z]*(\t) Match any number of characters followed by a tab
^.*\t Match the start of the line, then any number of any character up to and including a tab
[ ]\([A][0-9]\)( - Grade) Search for " (A7) - Grade" where the number 7 can be anything between 0 and 9 inclusive

Note that the above is all Unix Regular Expressions, some tools like UltraEdit also support Perl Regular Expressions and UltraEdit also has its own format.

Useful Sites


There is a great visualisation and debugging tool at Debuggex: Online visual regex tester. JavaScript, Python, and PCRE., well worth a look, and you'll be able to see some issues with my expressions above! Here are some more useful sites:

If you are trying to do Regular Expression searches in Notepad ++ then see Searching | Notepad++ User Manual


When working with Java, refer to Pattern (Java SE 11 & JDK 11 ) or see my demo /com/geoffdoesstuff/java/demo/


Being a Python fan, then it is always one of my first choices, for Regular Expression information then see Regular Expression HOWTO — Python v3.3.3 documentation or the 2.x equivalent if that is your version.

Powershell: The many ways to use regex


It is worth noting that Perl based regular expressions are a common standard and one that UltraEdit can use. If you are working with html or xml tags then you will need to understand UltraEdit perl regex tutorial: non-greedy regular expressions, which is a helpful article.


Being a very powerful and flexible editor it will hardly be a surprise that UltraEdit has three different regular expression engines built in: Perl, Unix, UltraEdit. The last two are documented at Regular expressions with find and replace. The Perl ones are described at the following:
Getting started with Perl regex in UltraEdit and UEStudio
Perl regular expressions in UltraEdit and UEStudio: Digging deeper
Perl regex backreferences in Find and Replace in UltraEdit


As one of the best sources of JavaScript documentation, Mozilla's MDN does not disappoint and they have both a buide and a reference for Regular Expressions in JavaScript: