Regular Expressions
What are they?
They are a way of specifying a
pattern of text. Whereas a typical application may enable you to
enter a specific string to be matched, an application that supports
Regular Expressions will enable you efficiently describe the range
of valid combinations of substrings that may make up a matched
string.
A search for one or more email
address's serves as a good example. The email address: "info@textpression.com"
is a simple string, you could use the Find functionality within your
web browser and locate this string simply by typing it in. But what
if you wanted to locate all of the email addresses on the site? You
could just enter the "textpression" domain part to get all of the
TextPression Software addresses, but what about the addresses of any
third party companies?
Clearly you need to describe in
general terms what you are looking for, rather than simply searching
for a string. For our email example this would be the sequence of
partial matches below:
- Find any valid combination of numerals, letters
and symbols that comprise the Name part of the email
address.
- Find an '@' symbol.
- Find any valid combination of numerals, letters
and symbols that comprise the Domain part of the email
address.
- Find a period.
- Find the final combination of
letters that comprise the Suffix part of the email
address.
How do I go about
writing a Regular Expression?
You can often access this
functionality by choosing from the "Advanced" search and replace
options on offer by many applications. The exact syntax for Regular
Expressions varies slightly according to the application that
supports them, however the example below is typical of the string
required to locate a valid email address:
-
\b[A-Z0-9._%-]++@[A-Z0-9._%-]+\.[A-Z]{2,4}\b
What do they have to do with
TextPression?
By now you've no doubt realised just
how useful Regular Expressions can be; however they can be a bit
daunting for the uninitiated (bare in mind that the example above is
for a fairly simple task) and even seasoned pro's often run into
trouble with them.
TextPression enables you to
graphically define expressions which give you much of the power of
Regular Expressions without the complexity. Its
Simple To Use Drag and Drop
Interface means that you can define expressions without needing
to learn and remember any special syntax.
Where can I find out more
about Regular Expressions?
For a good general overview visit:
|