Examples of regular expressions when used with PATROL objects and pathnames
This topic provides a brief list of examples that show you how to use regular expressions when you work with PATROL objects and path names.
Examples of regular expressions used with PATROL objects and pathnames
Regular Expression | Description | Regular expression | Regular expression |
---|---|---|---|
ConnectionException | Matches a text line that contains the string ConnectionException | ConnectionException | Connectionexception OutOfMemoryException |
PRINTER-[Hh]ouston | Matches any printer with the word Houston, irrespective of the case | PRINTER-Houston PRINTER-houston | PRINTER-Austin PRINTER-ouston |
Error.+18456 | Matches a test line quoting Error preceding one or more characters and then 18456 For example, Microsoft SQL Server, Error: 18456 | Microsoft SQL Server, Error: 18456 Microsoft SQL Server, Error: 318456 | Microsoft SQL Server, Error: 17842 Microsoft SQL Server, Error: 8456 |
usr[0-9]+ | Usr with a preceding number with one or more digits | usr11 | usr usr 11 |
usr[0-9]* | Usr preceding with zero or more digits | usr usr1234 | ussr usr 12 |
usr[0-9]? | The string “usr” preceding with zero or one digit between 0 and 9 | usr1 usr | usr11 |
usr[5-9][2-4] | Usr with to preceding digits, the first digit between 5 and 9 the second between 2 and 4 | usr63 usr52 usr94 | usr43 usr6 |
Fatal [^aA] | Fatal followed by a word that does not start with 'a' or 'A' For example, Fatal Error will match, Fatal Alarm will be ignored | Fatal Error | Fatal Alarm |
/dev/sd[a-c][0-3] | Matches disk devices on Linux machine | /dev/sdb1 | /dev/sde2 /dev/sde4 |
^connection.*failed$ | Starts with connection and ends with failed | Connection to host failed | Connection to host established |
.. | Matches any two-character string | ||
[Ww]arning | Matches Warning or warning | ||
[^a-zA-Z] | Matches anything except uppercase and lowercase letters | ||
st* | Matches a string that contains an s followed by zero or more t's such as stty | ||
(st)+ | Matches a string that has one or more sequences of st | ||
.* | Matches anything | ||
Warning\|warning | Matches warning or Warning |
Comments
Typing error on this page - check the description of the connection failed example;
^connection.*failed$
Starts with connection and ends with failure *** this should read failed ***
Connection to host failed
Connection to host established
Thanks, Andrew Threadgold . We have fixed the content.
Thanks and regards,
Swati
Log in or register to comment.