Translations:Development/KDevelop-PG-Qt Introduction/33/en
Regular Expressions
Regular expressions are used to write rules using the KDevelop-PG-Qt, we use the following syntax (α and β are arbitrary regular expressions, a and b characters):
- α|β accepts any word accepted by α or accepted by β
- α&β accepts any word accepted by both α and β
- α^β accepts any word accepted by a but not by β
- ~α accepts any word not accepted by α
- ?α like α, but also accepts the empty word
- α* accepts any (maybe empty) sequence of words accepted by α
- α+ accepts any nonempty sequence of words accepted by α (equivalent to αα*)
- α@β accepts any nonempty sequence of words accepted by α separated by words accepted by β (equivalent to α(βα)*)
- αβ accepts words consisting of a word accepted by α followed by a word accepted by β
- […] switches to “disjunctive” environment, αβ will get interpreted as α|β, you can use (…) inside the brackets to go back to normal mode
- . accepts any single character
- a-b accepts a single character between a and b (including a and b) in the Unicode (of course only characters that can be represented in the used encoding)
- "…" will accept the word enclosed by the quotation marks, escape sequences will still get interpreted
- a accepts the word consisting of the single character a
- Any escape sequence (see below), accepts the word consisting of the character represented by the escape sequence
- {⟨name⟩} accepts any word accepted by the regex named ⟨name⟩