Regular Expressions
The family of regular languages (also called or type ) is the simplest language family.
- Regular expressions can be ambiguous if there are multiple structurally different derivations that result in the same sentence. Sufficient conditions for ambiguity exist.
- Regular expressions can be extended with operators like union, concatenation, and star.
- A language on an alphabet is regular if it can be defined by a regular expression. So only if it is defined by concatenation, union and star over the elementary languages of ().
- Regular expressions have limits, as they cannot represent certain languages, such as those with unbalanced nesting or varying numbers of elements. To represent these languages, generative grammars must be used instead.
Regex
Regex basics:
xthexcharacter.any character except newline[xyz]meansxoryorz[a-z]any character betweenaandz[^a-z]any character except those betweenaandz
Said R a regular expression:
RSconcatenation ofRandSR|SeitherRorSR*zero or more occurrences ofRR+one or more occurrences ofRR?zero or one occurrence ofRR{m,n}a number orRoccurrences ranging fromntomR{n,}at least n occurrencesR{n}exactly n occurrences ofR