re_match [function]
re_match( string str, string pattern, int flags = 0, int offset = 0 )
check for matches in string str
for pattern
, returning whether a match was found or details of the first match, as specified in flags
offset
specifies the character to start matching from, negative offset is subtracted from the end
flags
expect RE_RETURN_CAPTURED, RE_RETURN_OFFSETS or RE_RETURN_BOTH, which is a combination of the previous two
- if
flags
is one of the special values, function returns an array of captured ranges
- each entry is either a string (on RE_RETURN_CAPTURED) or an array of beginning and end offsets (at positions 0 and 1, respectively, on RE_RETURN_OFFSETS) or an array of a string and the beginning and end offsets (on RE_RETURN_BOTH)
- the first character in the pattern specifies a delimiter that separates the pattern from modifiers
- example pattern strings: "/^[a-z]+/mi", "#[a-z0-9_]+.*?#s"
- more info about the supported features and modifiers at https://github.com/snake5/sgregex