Regular Expressions#

Regular Expressions must be given within forward slashes (/) and are match agains the whole value and not some part of it. Here’s a summary:

  • For characters:

Syntax

Example

Meaning

<any_non_special_character>

a

that character

<any_character>

6

any one character

[<any_character>]

[a?<>25]

any one character between brackets

[<any_character>-<any_other_character>]

[a-e]

any one character between those characters ([a-e] is equivalent to [abcde])

  • For repetitions:

Syntax

Meaning

*

0 or more times

+

1 or more times

{n}

exactly n times

{n,}

at least n times

{n,m}

from n to m times

RegExA|RegExB

Either RegExpA or RegExpB

  • Some examples:

Syntax

Meaning

abc

exactly abc

[abc]

either a, b or c

[abc]{3}

three characters from those given. E.g. aaa, bab or cab

[abc]{2,4}

two to four characters from those given. E.g. aaa, ab or cccc

[a-z]+[0-9]*

One ore more characters followed by cero or more number, e.g. a, tas, cfaddbze94

[a-z]|[0-9]

any alphabetic or numeric character