Examples - excluding a string
Using Regex for specific filter: Exclude a string
In this example we want to exclude everything that contains the string server.
To do this, we will use the following Regular Expression:
^((?!.*server.*).)*$
Breakdown of Regex elements used
^ | Beginning of the string |
() | Capturing Group |
(?!) | Negative look ahead. Specifies a group that cannot match after the main expression. (i.e. if it matches, then the result is discarded) |
. | Matches any character except line breaks |
* | Match 0 or more of the preceding token |
server | String |
$ | End of the string |
Note | You can get the same result by excluding each character of the string.
|
---|
Practical case
In this example we will use Filter by Regular Expression to exclude everything that contains the string server in the Type column.
Click on the filter icon and select Filter By Regular Expression.
Having used the expression ^((?!.*server.*).)*$ to filter the column, all lines that contained the string server have now been excluded.
TIP | Excluding multiple strings:
|
---|