This page should only give you a short introduction into the concept of regular expressions and is far from complete. For more information on the subject, reading Regular Expressions by Jeffrey E.F. Friedl, O'REILLY, is highly recommended.
Regular expressions are search patterns which you can use to test strings. For example, you can use a regular expression to test the message text of an IP message or data sent via the serial interface. A regular expression consists of one or several characters you are searching for and of special characters that are performing certain functions.
A machine sends data via the serial interface such as this sample:
The regular expression
If you want to search for a character from the left column of the table below or for the backslash "\" or minus "-" characters, precede them with a backslash "
\" (this is also called masking).
|The ^ character marks the start of a string. The expression
^Test is only true for strings that start with Test.
|The $ character marks the end of a string. The expression
Test$ only is true for strings that end with Test.
The full stop character is a placeholder for one character. The
When searching for the . character itself, you need to mask it by preceding it with a backslash "\". In this case, the expression
|The asterisk character is a repeat operator meaning that the preceding character may either occur never or an unlimited number of times. The expression
ab*c is true for abc, abbbbbc, but also for ac.
|The plus character is a similar repeat operator meaning that the preceding character may either occur once or an unlimited number of times. The expression
ab+c is true for abc, abbbbbc, but not for ac.
|The question mark character means that the preceding character may occur once or never. The expression
ab?c is true for abc and ac, but not for abbc.
Expressions surrounded by [square brackets] represent a character class.
A character class can be defined either as a list or as a range. The expression
A character class can also be negated by using a preceding caret "^" character. The expression
|cn, de, en, es, fr, it, jp, ru