Image Uploader Scripting API
Public Member Functions | List of all members
CRegExp Class Reference

Public Member Functions

 CRegExp (string expression, string flags)
 
array findAll (string stuff)
 
int getEntireMatchEnd () const
 
int getEntireMatchStart () const
 
string getMatch (int pos) const
 
int getMatchEnd (int pos) const
 
int getMatchStart (int pos) const
 
array getSubStrings ()
 
bool match (string stuff)
 
bool matched ()
 
int matchesCount ()
 
string replace (string piece, string with)
 
bool search (string stuff)
 
bool searchWithOffset (string stuff, int OffSet)
 
array split (string piece)
 
array splitWithLimit (string piece, int limit)
 
array splitWithLimitOffset (string piece, int limit, int start_offset)
 
array splitWithLimitStartEndOffset (string piece, int limit, int start_offset, int end_offset)
 

Detailed Description

PCRE-compatible regular expression

Constructor Destructor Documentation

◆ CRegExp()

CRegExp ( string   expression,
string   flags 
)

Creating instance: local regex = CRegExp(pattern, flags);

pattern - regular expression,

flags:

i - PCRE_CASELESS

If this modifier is set, letters in the pattern match both upper and lower case letters.

m - PCRE_MULTILINE

By default, PCRE treats the subject string as consisting of a single "line" of characters (even if it actually contains several 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 D modifier is set). This is the same as Perl. When this modifier is set, the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the subject string, respectively, as well as at the very start and end. This is equivalent to Perl's /m modifier. If there are no "\n" characters in a subject string, or no occurrences of ^ or $ in a pattern, setting this modifier has no effect.

s - PCRE_DOTALL

If this modifier is set, a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded. This modifier is equivalent to Perl's /s modifier. A negative class such as [^a] always matches a newline character, independent of the setting of this modifier.

x - PCRE_EXTENDED

If this modifier is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class, and characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored. This is equivalent to Perl's /x modifier, and makes it possible to include commentary 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.

u - PCRE_UTF8|PCRE_UCP

This modifier turns on additional functionality of PCRE that is incompatible with Perl. Pattern and subject strings are treated as UTF-8. Five and six octet UTF-8 sequences are regarded as invalid.

g - global