Please enable JavaScript to view this site.

A-Shell Reference

Navigation: Subroutines > REGEX

Options Flags

Scroll Prev Top Next More

Updated December 2023; see History

Symbol

Value

Description

PCRE_CASELESS

&h00000001

If this bit is set, letters in the pattern match both upper and lower case letters. It is equivalent to Perl's /i option, and it can be changed within a pattern by a (?i) option setting. In UTF-8 mode, PCRE always understands the concept of case for characters whose values are less than 128, so caseless matching is always possible. For characters with higher values, the concept of case is supported if PCRE is compiled with Unicode property support, but not otherwise. If you want to use caseless matching for characters 128 and above, you must ensure that PCRE is compiled with Unicode property support as well as with UTF-8 support.

PCRE_MULTILINE

&h00000002

By default, PCRE treats the subject string as consisting of a single line of characters (even if it actually contains newlines). The "start of line" metacharacter (^) matches only at the start of the string, while the "end of line" metacharacter ($) matches only at the end of the string, or before a terminating newline (unless PCRE_DOLLAR_ENDONLY is set). This is the same as Perl.

PCRE_DOTALL

&h00000004

If this bit is set, a dot metacharater in the pattern matches all characters, including those that indicate newline. Without it, a dot does not match when the current position is at a newline. This option is equivalent to Perl's /s option, and it can be changed within a pattern by a (?s) option setting. A negative class such as [^a] always matches newline characters, independent of the setting of this option.

PCRE_EXTENDED

&h00000008

If this bit is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class. Whitespace does not include the VT character (code 11). In addition, characters between an unescaped # outside a character class and the next newline, inclusive, are also ignored. This is equivalent to Perl's /x option, and it can be changed within a pattern by a (?x) option setting. This option makes it possible to include comments inside complicated patterns. Note, however, that this applies only to data characters. Whitespace characters may never appear within special character sequences in a pattern, for example within the sequence (?( which introduces a conditional subpattern.

PCRE_ANCHORED

&h00000010

If this bit is set, the pattern is forced to be "anchored", that is, it is constrained to match only at the first matching point in the string that is being searched (the "subject string"). This effect can also be achieved by appropriate constructs in the pattern itself, which is the only way to do it in Perl.

PCRE_DOLLAR_
ENDONLY

&h00000020

If this bit is set, a dollar metacharacter in the pattern matches only at the end of the subject string. Without this option, a dollar also matches immediately before a newline at the end of the string (but not before any other newlines). The PCRE_DOLLAR_ENDONLY option is ignored if PCRE_MULTILINE is set. There is no equivalent to this option in Perl, and no way to set it within a pattern.

PCRE_UNGREEDY

&h00000200

This option inverts the "greediness" of the quantifiers so that they are not greedy by default, but become greedy if followed by "?". It is not compatible with Perl. It can also be set by a (?U) option setting within the pattern.

PCREX_VERBOSE

&h10000000

With ++include transcopy, more verbose error messages.

PCREX_ASB_
SOURCE

&h20000000

(For TRCOPY/transclude only) Treat subject as ASB source, merging continuation lines into one.

PCREX_NOT_
PRECOMPILED

&h08000000

Eliminates the ambiguity when passing a single-byte pattern to INSTR() or REGEXxs as to whether it represents a normal pattern or a previously precompiled pattern number.

PCREX_ASB_
SOURCE

&h20000000

 

Treat srcfile as A-Shell Basic, merging continuation lines into one. This  may affect the pattern matching which is otherwise limited to one source line at a time.

PCREX_
SUBMATCH_
ARRAY

&h400000000

This is not a standard PCRE flag (hence the prefix PCREX_). It is used to indicate that you are passing a single element of an array of subcnt elements to receive the subexpression matches, rather than just a single variable (which could receive only one sub-match).

PCREX_PRECOMPILE

&h80000000

Another non-standard flag. It is used with the INSTR() function to indicate that you only want to precompile the pattern; see INSTR() for more details.

Definition File: regex.def

 

History

2023 December, A-Shell 7.0.1752:  Added PCREX_NOT_PRECOMPILED