Regular expression

A regular expression, regex or regexp (sometimes called a rational expression) is, in theoretical computer science and formal language theory, a sequence of characters that define a search pattern. Usually this pattern is then used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. - wikipedia

- Regex examples - https://github.com/aloisdg/awesome-regex - https://www.regular-expressions.info - JavaScript RegExp Reference - w3schools - Engine comparison - wikipedia - https://www.regextranslator.com/ - http://rick.measham.id.au/paste/explain.pl

# Livecode

LiveCode implements regular expressions compatible with the PCRE library. For detailed information about regular expression elements you can use with this function.

The special regular expression characters are:

. \ + * ? [ ^ ] $ ( ) { } = ! < > | : -

To represent these chars in a regular expression directly without using their special meaning you need to escape them by prepending the "\" character.

Note that / is not a special regular expression character.

i for PCRE_CASELESS m for PCRE_MULTILINE s for PCRE_DOTALL x for PCRE_EXTENDED U for PCRE_UNGREEDY X for PCRE_EXTRA

For example, (?im) sets caseless, multiline matching.

It is also possible to unset these options by preceding the letter with a hyphen, and a combined setting and unsetting such as (?im-sx), which sets PCRE_CASELESS and PCRE_MULTILINE while unsetting PCRE_DOTALL and PCRE_EXTENDED , is also permitted. If a letter appears both before and after the hyphen, the option is unset.

# History

The concept arose in the 1950s when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities. Since the 1980s, different syntaxes for writing regular expressions exist, one being the POSIX standard and another, widely used, being the Perl syntax.

Stephen Cole Kleene, who helped found the concept - wikimedia.org

Regular expressions are used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as sed and AWK and in lexical analysis. Many programming languages provide regex capabilities, built-in or via libraries.

# Sections

# See also

- Translator - regextranslator.com - Test expressions - regextester.com - Cheat sheet - rexegg.com - PCRE manual - pcre.org - Library - regexlib.com

- Awesome-regex on github - https://www.regextranslator.com/ - https://www.regular-expressions.info - JavaScript RegExp Reference - w3schools