System.RegularExpressionsCore.TPerlRegExOptions

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TPerlRegExOptions = set of (
preCaseLess,       // /i -> Case insensitive
preMultiLine,      // /m -> ^ and $ also match before/after a newline, not just at the beginning and the end of the string
preSingleLine,     // /s -> Dot matches any character, including \n (newline). Otherwise, it matches anything except \n
preExtended,       // /x -> Allow regex to contain extra whitespace, newlines and Perl-style comments, all of which will be filtered out
preAnchored,       // /A -> Successful match can only occur at the start of the subject or right after the previous match
preUnGreedy,       // Repeat operators (+, *, ?) are not greedy by default (i.e. they try to match the minimum number of characters instead of the maximum)
preNoAutoCapture   // (group) is a non-capturing group; only named groups capture
);

C++

typedef System::Set<System_Regularexpressionscore__1, System_Regularexpressionscore__1::preCaseLess, System_Regularexpressionscore__1::preNoAutoCapture> TPerlRegExOptions;

Properties

Type Visibility Source Unit Parent
set
typedef
public
System.RegularExpressionsCore.pas
System.RegularExpressionsCore.hpp
System.RegularExpressionsCore System.RegularExpressionsCore

Description

Match option enumeration set for the Perl regular expression.

Option Meaning

preCaseLess

Tries to match the regex without paying attention to case. If set, 'Bye' will match 'Bye', 'bye', 'BYE' and even 'byE', 'bYe', and so on. Otherwise, only 'Bye' will be matched. Equivalent to Perl's /i modifier.

preMultiLine

The ^ (beginning of string) and $ (ending of string) regex operators will also match right after and right before a new line in the Subject string. This effectively treats one string with multiple lines as multiple strings. Equivalent to Perl's /m modifier.

preSingleLine

Normally, dot (.) matches anything but a new line (\n). With preSingleLine, dot (.) will match anything, including new lines. This allows a multiline string to be regarded as a single entity. Equivalent to Perl's /s modifier. Note that preMultiLine and preSingleLine can be used together.

preExtended

Allow the regular expression to contain extra white spaces, new lines, and Perl-style comments, all of which will be filtered out. This is sometimes called "free-spacing mode".

preAnchored

Allows the regular expression to match only at the start of the subject or right after the previous match.

preUnGreedy

Repeat operators (?, *, +, {num,num}) are greedy by default, for example, they try to match as many characters as possible. Set preUnGreedy to use ungreedy repeat operators by default, for example, so that they try to match as few characters as possible.

preNoAutoCapture

Allows the regular expression to capture only named groups. Note that (group) is a non-capturing group.

See Also