Use Regular Expressions in Queries
Power query building
The pre-processor in the query builder can do some nifty stuff. We're not talking full PCRE, but it's still able to use one or two useful things. This is a very handy thing for sites with strict naming conventions, so let's look at some examples:
- Device Name begins with S, has two numbers, and then an A: "Computer"."Device Name" LIKE s[0-9][0-9]a*
- Device Name begins with S or A or P, followed by any letter:
"Computer"."Device Name" LIKE [s|a|p][a-z]* - Device Name ends with X or 42: "Computer"."Device Name" LIKE *[X|42]
- Device Name begins with three letters, followed by an O: "Computer"."Device Name" LIKE [A-Z][A-Z][A-Z][O]*
- The third octet in the IP address is 15: "Computer"."Network"."TCPIP"."Address" LIKE [0-9][0-9][0-9].[0-9][0-9][0-9].015.[0-9][0-9][0-9]
, which is a bummer.
Remember, anything built in the query builder can be used as a scope or custom report, so have fun with it.