Regular expressions

Top  Previous  Next

Texts are summarised into Moskito G SHARP often to groups. This can be, e.g., file names by which several should be defined according to a rule. This happens with the help of regular expressions.

 

A regular expression is a pattern which is applied as a rule to a text. Then it turns out either a hit or not.

 

Regular expressions exist of normal signs and the special characters *?, []!, ^, - and \.

 

The signs mean in detail:

 

* for any number of any signs

? for exact any sign

[SET] exactly one of the signs described in SET

[! SET] or [^SET] exactly one of the signs not specified in SET

[Set *] arbitrarily many of the signs specified in SET

SET is defined by enumeration (without separator) or areas of letter (case sensitively) or pay with syntax a-z.

 

Do the special characters [] * have to go?! ^ - \are treated as normal signs, must be predone these in each case \.

 

Examples

 

Pattern

Text

Result

ABC

ABC

Hit

Abcd

ABC

No hit

*

ABC

Hit

B*

ABC

No hit

[a-d] *

bx

Bx

b

Hit

No hit

Hit

*x*

ABC

x

axz

KeinTreffer

Hit

Hit

Stream [0-9]

Strom1

Stream 11

Hit

No hit

Stream [0-3 *]

Strom1

Stream 4

Stream in 1221

Hit

No hit

Hit

M [! e *] [iy] he

Meier

Mayer

Maier

Mark

No hit

Hit

Hit

Hit