Command Group: Strings - Regular Expression – Category

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[https?\:\/\/en\.wikipedia\.org\/wiki\/([^ ]+) (.+)\]" to "{{Wikipedia|$1|$2}}")
(added link to regexr.com)
Line 1: Line 1:
For a detailed explanation of what a Regular Expression (Regex) is , please visit {{Wikipedia|Regular_expression|wikipedia}}.
For a detailed explanation of what a Regular Expression (Regex) is , please visit {{Wikipedia|Regular_expression|wikipedia}}.
{{Feature|Informative|The following page allows to pre-test regular expressions: {{ExternalLink|link= https://regexr.com/}}}}





Revision as of 17:35, 15 June 2021

For a detailed explanation of what a Regular Expression (Regex) is , please visit wikipedia.

The following page allows to pre-test regular expressions: https://regexr.com/


In order to adjust the behaviour of the regex commands, certain flags can be set when using them. Flags are specified at the end of the pattern and start with /. Flags need to be lowercase. If there are any non-flag characters in the flags they will be ignored and considered part of the pattern itself. "I'm a coOkIe clicker" regexMatch ".*cookie.*/gio"// Flag g, i and o are set

Flag Description (short) Description (detailed)
g Global Only relevant for regexReplace and regexFind. Missing global flag sets format_first_only flag (source) and only replaces first occurrence with regexReplace and only returns first element with regexFind
i Case insensitive -
n noSubs
«
« When performing matches, all marked sub-expressions (expr) are treated as non-marking sub-expressions (?:expr). No matches are stored in the supplied std::regex_match structure and mark_count() is zero » – c++ reference (source)
o Optimize Optimize pattern, pattern creation is slower, but will execute more efficiently (source)
If no flags are specified, the default flags are set to g and i. It is valid to specify / to indicate no flags, first match only, case sensitive.

Pages in category "Command Group: Strings - Regular Expression"

The following 3 pages are in this category, out of 3 total.