# Regular Expressions

Regular Expressions can be used as criteria for filter if you do text searching. The match of the text and the regular expression will be proved.

With Regular Expressions you can for example search for words that begin with "s" and end with "d", without defining the letters between.

Don't be put off because it may look confusing and difficult on the first view.

Just read every point step by step. It could be useful to do step by step what is explained here, parallel in the online- testing website.

## 1. Requirements

All the Regular Expressions have to be in #.

(There are other boundary signs, but in the following examples and all the Solutions we will concentrate on limiting with #.)

This function will find: Sneaker

Examples - frequently used functions

## 2. Text Search

This expression searches if there is a 1 or 2 or 3 or 4 or 5 or 6 in the text.

you can also write that shorter, it means the same !

This expression will search for all the letters between a and z (ä,ö,ü,ß are not included).

If you want to include ä,ö,ü, ß, you have to write it like this:

This function searches for: "color:" , color can contain every letter from a-z and äüöß, but no number.

The plus means that the letters after "color:" can appear once or more.

For example in the word "red", there are 3 appears, so the plus is essential.

If you want to skip a letter or a number you can write:

This expression will search all the numbers from 1 to 3 and from 5 to 6, so we skip number 4.

## 3. Usage of Special Signs

()

The round brackets we use to summarize longer expressions together as one element.

So if we relate on the previous element, the whole expression inside the brackets is meant.

?

The question mark says: the previous element can appear but not has to appear.

So it will be found following expression combinations: Sneaker Boots, Boots, Sneaker

+

The plus means that that the previous element can appear once or more.

That means nothing else but that it is a word. Without the plus we would search just for ONE letter from a-z, which makes no sense normally.

.

The point stands for any single sign.

Because of the plus this optional signs can appear once or more.

This expression will find all the words in the text that start with an "M" and end with "er", no matter how many letters are between.

For example the names: Müller, Mayer, Meyer, Maier, Möllerunger,...

*

The * means: the previous element can appear Once/ Several times, or NOT. So it can appear, but not has to. It can also be a " "(space) in there.

The * means just the element directly previous "SXLM", "size:" has to appear!

So it could be found: "size: XS", "size: S", "size: " , "size: XXXXL"

This function searches for: "color:",after "color:" can be a word with all letters from a-z, without äüöß, the letters can appear more than once.

It also searches for "size:", that consists of the letters S,X,L,M, which can appear several times or not.

^

This is your Example - Text: "- this is a description - and here it goes on"

You just want to edit the first dash "-" , you have to use following expression:

In the second case the sign ^ is outside of the brackets, that means:the regular expression/ searching string starts with optional numbers from 0-9 and it has to appear at least one of the sings.

The first number/digit will be deleted, all the others not.

Text before: "97 cm size"

Text after: "cm size"

...and if now the ^ is inside the brackets:

That means: The expression we search for must not include the numbers from 0-9.

--> That means, we are searching for everything, except a number, and delete it.

Text before: "97 cm size"

Text after: "97"

|

This sign finds the expressions that appear before and after it.

Example: #this|that# finds "this" and "that".

This expression is useful, if you have one word, written in two different ways.

Because the option with .+ gives you everything, no matter what is between.

This option just searches for: "Müller" and "Maier".

****

This slash means: The previous element is no function.

Example: + means: This + is to take as an arithmetic operator to calculate.

Don't confound the normal slash / with

i

If you write an i after your Expression, you ignore capitalization.

This function will find the words Müller, Mayer, müller, mayer, MAIER, MinisteR,...

U

The letter U, attached to the function in #, tells the system to find the expression that appears first in the text. the second will stay uncared.

Ui

You can combine the letters attaches to the expression.

This function will search for the word Sneaker, no matter if it is written capitalized or not (because of the i): SNEAKER, Sneaker, sneakER,...

And it will just find the word that appears first in the text (because of the U).

Problems

If the Regular Expression you made doesn't work, the mistake can come from the special signs.

Just one little point can make your searching- task searching in the wrong way.

## 4. Useful links

Training - here you can practise online, and see the results directly (Site in German).

Hereare all functions listed and explained, available in many languages.

For more functions click here(Site in German), this is a very easy explained site with practical examples.

For a video- tutorial on youtube.de which explains quick and easy more functions - click here(also in German).