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.
[...]
2003-09-22 12:24:50 roboctrl ready
2003-09-22 12:24:51 roboctrl starting process
2003-09-22 12:25:25 roboctrl finished in 34sec
2003-09-22 12:25:30 roboctrl ready
2003-09-22 12:25:31 roboctrl starting process
2003-09-22 12:25:33 error: no material found
2003-09-22 12:25:33 roboctrl stop on error
The regular expression stop.*error
will trigger an event if the machine returns an error as in the last line of the example.
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).
Character |
Function |
---|---|
^ |
The ^ character marks the start of a string. The expression |
$ |
The $ character marks the end of a string. The expression |
. |
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 |
+ |
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 |
? |
The question mark character means that the preceding character may occur once or never. The expression |
[ ] |
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 For example, A character class can also be negated by using a preceding caret "^" character. The expression |