Search using RegEx (Regular Expressions)

search

#1

A recent request was to find all customers whose Postcode (UK) was in Birmingham, where the Postcode starts with the letter B followed by a number.

A normal search for B* results in matches for all postcodes starting with a B, eg BH9 1AB and BR2 1AB
which are codes in other cites (Bournemouth and Bristol).

You can use RegEx
B[0-9]*

Which translates to
1st char: Must be a B
2nd Char: Must be a number 0-9
Anything Else

This method can be used for searching specific product codes or names. Example:
GU[0-9] = Will find all products with a GU followed by a number eg GU10, GU4 in their description.

Note these need to be entered in the advanced search function, not the normal simple search box.


#2

Can you use the RegEx for letters or symbols? In the examples listed above you only used it for [0-9].


#3

You can search using most simple RegEx functions (Excluding \ Operators)

[A-Z] matches letters A thru Z
b[aeiou]t matches bat,bet,bit,bot,but
b[^ae]t matches b*t but not bat,bet


#4

Awesome, thanks for the information!

Bo Anderson
Business Intelligence Analyst
Mobile – 319.551.7260