Common Regular Expressions

There are various versions of regular expressions. WaveLab Pro uses a version that represents a good compromise between power and ease-of-use.

The term expression refers to a single character, a character class, or a sub-expression enclosed with () or {}. Searches for regular expressions are not case sensitive.

Regular Expressions Pop-up Menu


Menu Item

Operator

Description

Any Character

.

Symbolizes any character.

Character in Range

[ ]

A bracketed text is treated as a single character, for example: [AEW13] means A or E or W or 1 or 3. A hyphen within the brackets specifies a range of characters. For example, [F-I] means F or G or H or I, and [A-Z0-9] matches all letters and all digits.

Character Not in Range

[^]

A circumflex located at the first position in a bracket is a complement operator. It describes a situation where all characters match except those included in the bracket. For example, [^E] means any character except E.

0 or 1 Match (1 if Possible)

?

Matches 0 or 1 time the preceding expression. 1 repeat if possible is grabbed, then the rest of the regular expression continues to be evaluated.

0 or 1 Match (0 if Possible)

??

Matches 0 or 1 time the preceding expression. 0 repeat if possible (the NEXT step in the regular expression is also evaluated and has priority).

0 or More Matches (as Many as Possible)

*

Matches 0 or more times the preceding expression. As many repeats as possible are grabbed, then the rest of the regular expression continues to be evaluated.

0 or More Matches (as Few as Possible)

*?

Matches 0 or more times the preceding expression. As few repeats as possible are grabbed (the NEXT step in the regular expression is also evaluated and has priority).

1 or More Matches (as Many as Possible)

+

Matches 1 or more times the preceding expression. As many repeats as possible are grabbed, then the rest of the regular expression continues to be evaluated.

1 or More Matches (as Few as Possible)

+?

Matches 1 or more times the preceding expression. As few repeats as possible are grabbed (the next step in the regular expression is also evaluated and has priority).

Or

|

OR operator. Use this to separate two expressions and to match expression #1 or expression #2. For example, Piano|Drum matches all texts that contain Piano or Drum.

Not

!

Negation operator: the expression following ! must not match the text. For example, a!b matches any a not followed by b.

Generic Group

()

Grouping operator. Useful to form a sub-expression.

Capture

{}

Capture operator. By default, the found text corresponds to the entire regular expression. But it is possible to limit a part of the regular expression with { }, and if a part is matched, this will be the retained part. For instance the regular expression ab{cd}ef that is applied on abcdef will return cd.

Beginning of Text

^

Use the circumflex sign to specify that the text must be located at the start of the browsed text. Any match not located at the start of the browsed text is ignored.

End of Text

$

Use this sign to specify that the text must be located at the end of the text. Any match not located at the end of the text is ignored.


Special Characters Submenu

On this submenu, all special characters for regular expressions are available.

Shortcuts Submenu


Menu Item

Operator

Description

Any Digit (0-9)

/d

Symbolizes any digit, as [0-9].

Any Non-Digit (not 0-9)

/D

Symbolizes any non-digit, as [^0-9].

Any Letter (a-z or A-Z)

/l

Symbolizes any letter, as [a-z].

Any Non-Letter (not a-z, not A-Z)

/L

Symbolizes any non-letter, as [^a-z].

Any Alphabetic (a-z, or A-Z, or 0-9)

/w

Symbolizes any alphabetic character, as [0-9a-z].

Any Non-Alphabetic (not a-z, not A-Z, not 0-9)

/W

Symbolizes any non-alphabetic character, as [^0-9a-z].

Number

/u

Symbolizes a number (without a sign).

Number (with Possible +- Before)

/i

Symbolizes a number which can be preceded by a + or - sign.

Quoted String

/q

Symbolizes quoted text.

Simple Word

/z

Symbolizes a simple word (a sequence of letters surrounded by non-letters, for example, spaces).


Presets Submenu


Menu Item

Operator

Description

1st Word

/z

Searches for the first word (separated by a space).

2nd Word

/z/L+{/z}

Searches for the second word (separated by a space).

3rd Word

/z/L+/z/L+{/z}

Searches for the third word (separated by a space).

Last Word

{/z}/L*$

Searches for the last word (separated by a space).

1st Expression in Parentheses

.*?{/(.*?/)}

Searches for the first string enclosed in parentheses.

2nd Expression in Parentheses

.*?/(.*?{/(.*?/)}

Searches for the second string enclosed in parentheses.

3rd Expression in Parentheses

.*?/(.*?/(.*?{/(.*?/)}

Searches for the third string enclosed in parentheses.

Last Expression in Parentheses

.*{/(.*?/)}.*$

Searches for the last string enclosed in parentheses.

1st Expression in Brackets

.*?{/[.*?/]}

Searches for the first string enclosed in brackets.

2nd Expression in Brackets

.*?/[.*?{/[.*?/]}

Searches for the second string enclosed in brackets.

3rd Expression in Brackets

.*?/[.*?/[.*?{/[.*?/]}

Searches for the third string enclosed in brackets.

Last Expression in Brackets

.*{/[.*?/]}.*$

Searches for the last string enclosed in brackets.