PureBasic - RegExpEx
Overview
Regular expressions are used to recognize patterns within textual data. Their use has become so widespread that they appear in configuration files, mail filters, text editors, and any number of programming languages. Any application that acts on text may very well harness their power. Regular expressions evaluate text data and return an answer of true or false. That is, either the expression correctly describes the data, or it doesn't.
The original regexp engine was written by Henry Spencer and was extended by Benoit Goudreault-Emond. This particular implementation is a superset of the "extended regular expression" dialect and a second attempt to use regular expressions in PureBasic.Essentially, the following expressions are available:
- Metacharacters ".", "[...]" and "[^...]"
- "+", "*" and "?" quantifiers
- Anchors "^", "$", "\<" and "\>"
- Alternation "|"
- Subexpressions "(...)"
- Cheap character classes "\x" where x is a letter which maps to a primitive ctype.h function, as follows:
- "\m": tests for any character that is alphanumeric.
- "\a": tests any character that is one of a locale-specific set of alphabetic characters.
- "\b": essentially maps space and tab.
- "\c": tests for any control character
- "\d": tests for any decimal-digit character.
- "\g": tests for any printing character except space.
- "\l": tests for any character that is a lowercase letter or one of a locale-specific set of characters, except space, decimal-digits, control characters or punctuation.
- "\p": tests for any printing character including space.
- "\n": tests for any printing character that is one of a locale-specific set of punctuation characters, except space and alphanumeric characters.
- "\s": tests for any character that is a standard white-space character (space, form feed, new-line, carriage return, horizontal tab and vertical tab).
- "\u": tests for any character that is an uppercase letter or one of a locale-specific set of characters, except space, decimal-digits, control characters or punctuation.
- "\x": tests for any hexadecimal-digit character.
- "\w": matches alphanumeric
and
the underscore character.<Capitalize the letter to get the reverse match (for instance, "\D" matches every character that isn't a decimal-digit character).
Have fun,
FloHimself - Nov 1, 2003 (v1.0)
Command Index
RegCompEx
RegErrorEX
RegExecEx
RegFreeEx
RegNSubExpEX
RegSubEx
Supported OS
Linux