Regex

Can search and replace strings using regular expressions. Regular expressions have a time limit, so it will fail if not completed in time.

# Properties

[{"index":"boolean IsRightToLeft (ReadOnly)","0":"Checks if the matching direction of the regular expression is from right to left."}]

# Constructors

[{"index":"Regex(string pattern)","0":"Initializes the Regex with the default value."}]

[{"index":"Regex(string pattern, RegexOption options)","0":"Initializes the Regex with specified pattern and options values."}]

# Methods

[{"index":"table GetGroupNames()","0":"Returns the regular expression group names."}]

[{"index":"table GetGroupNumbers()","0":"Returns the regular expression group numbers."}]

[{"index":"string GroupNameFromNumber(int32 number)","0":"Gets the name of the group whose number is number. When there is no match, returns nil."}]

[{"index":"int32 GroupNumberFromName(string name)","0":"Gets the number of the group whose name is name. When there is no match, returns -1."}]

[{"index":"boolean IsMatch(string origin)","0":"Finds and returns regular expression matches in the origin sentence."}]

[{"index":"boolean IsMatch(string origin, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, finds and returns the first hit that matches the regular expression pattern."}]

[{"index":"RegexMatch Match(string origin)","0":"Searches the origin sentence for the first hit matching the regular expression pattern. If it fails, returns nil."}]

[{"index":"RegexMatch Match(string origin, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, searches for the first hit that matches the regular expression pattern. If it fails, returns nil."}]

[{"index":"RegexMatch Match(string origin, int32 startIndex, int32 length)","0":"Starting from the startIndex in the origin sentence, searches for the first hit that matches the regular expression pattern within the specified string length. If it fails, returns nil."}]

[{"index":"table Matches(string origin)","0":"Searches the origin sentence for the all hits matching the regular expression pattern."}]

[{"index":"table Matches(string origin, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, searches for the all the hits matching the regular expression pattern."}]

[{"index":"string Replace(string origin, string replacement)","0":"Replaces all hits matching the regular expression pattern in the origin sentence. If it fails, returns nil."}]

[{"index":"string Replace(string origin, string replacement, int32 count)","0":"Replaces hits matching the regular expression pattern in the origin sentence, up to a specified count. If it fails, returns nil."}]

[{"index":"string Replace(string origin, string replacement, int32 count, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, finds hits that match the regular expression pattern. Replaces hits, up to the specified count. If it fails, returns nil."}]

[{"index":"string ReplaceByEvaluator(string origin, func -> string evaluator)","0":"Replaces all hits matching the regular expression pattern in the origin sentence with the string returned by the evaluator. If it fails, returns nil."}]

[{"index":"string ReplaceByEvaluator(string origin, func -> string evaluator, int32 count)","0":"Replaces all hits matching the regular expression pattern in the origin sentence with the string returned by the evaluator up to the specified count. If it fails, returns nil."}]

[{"index":"string ReplaceByEvaluator(string origin, func -> string evaluator, int32 count, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, replaces hits matching the regular expression pattern with the string returned by the evaluator up to the specified count. If it fails, returns nil."}]

[{"index":"table Split(string origin)","0":"Splits the string in the origin sentence based on hits matching the regular expression pattern. If it fails, returns nil."}]

[{"index":"table Split(string origin, int32 count)","0":"Splits the string in the origin sentence based on hits matching the regular expression pattern, up to the specified count. If it fails, returns nil."}]

[{"index":"table Split(string origin, int32 count, int32 startIndex)","0":"Starting from the startIndex in the origin sentence, splits the string based on hits matching the regular expression pattern, up to the specified count. If it fails, returns nil."}]

# SeeAlso

  * [Regular Expression Syntax](/docs?postId=1043)
  * [Regular Expressions](/docs?postId=1041)