Regex
Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
Note that the pattern syntax and the option set has differences on each platform. See the docs of Regex
for the specific platform for details.
Since Kotlin
1.0Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
For pattern syntax reference see MDN RegExp and http://www.w3schools.com/jsref/jsref_obj_regexp.asp.
Note that RegExp
objects under the hood are constructed with the "u" flag that enables Unicode-related features in regular expressions. This also makes the pattern syntax more strict, for example, prohibiting unnecessary escape sequences.
Since Kotlin
1.1Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
For pattern syntax reference see Pattern.
Since Kotlin
1.0Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
Note that in the future, the behavior of regular expression matching and replacement functions can be altered to match JVM implementation behavior where differences exist.
Since Kotlin
1.3Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
Note that in the future, the behavior of regular expression matching and replacement functions can be altered to match JVM implementation behavior where differences exist.
Since Kotlin
1.8Represents a compiled regular expression. Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.
Note that in the future, the behavior of regular expression matching and replacement functions can be altered to match JVM implementation behavior where differences exist.
Since Kotlin
1.8Constructors
Creates a regular expression from the specified pattern string and the default options.
Creates a regular expression from the specified pattern string and the default options.
Creates a regular expression from the specified pattern string and the default options.
Creates a regular expression from the specified pattern string and the default options.
Creates a regular expression from the specified pattern string and the default options.
Creates a regular expression from the specified pattern string and the default options.
Types
Properties
The set of options that were used to create this regular expression.
The set of options that were used to create this regular expression.
The set of options that were used to create this regular expression.
The set of options that were used to create this regular expression.
The set of options that were used to create this regular expression.
The set of options that were used to create this regular expression.
Functions
Indicates whether the regular expression can find at least one match in the specified input.
Indicates whether the regular expression can find at least one match in the specified input.
Indicates whether the regular expression can find at least one match in the specified input.
Indicates whether the regular expression can find at least one match in the specified input.
Indicates whether the regular expression can find at least one match in the specified input.
Indicates whether the regular expression can find at least one match in the specified input.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns the first match of a regular expression in the input, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Returns a sequence of all occurrences of a regular expression within the input string, beginning at the specified startIndex.
Attempts to match the entire input CharSequence against the pattern.
Attempts to match the entire input CharSequence against the pattern.
Attempts to match the entire input CharSequence against the pattern.
Attempts to match the entire input CharSequence against the pattern.
Attempts to match the entire input CharSequence against the pattern.
Attempts to match the entire input CharSequence against the pattern.
Indicates whether the regular expression matches the entire input.
Indicates whether the regular expression matches the entire input.
Indicates whether the regular expression matches the entire input.
Indicates whether the regular expression matches the entire input.
Indicates whether the regular expression matches the entire input.
Indicates whether the regular expression matches the entire input.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces all occurrences of this regular expression in the specified input string with the result of the given function transform that takes MatchResult and returns a string to be used as a replacement for that match.
Replaces all occurrences of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Replaces the first occurrence of this regular expression in the specified input string with specified replacement expression.
Splits the input CharSequence to a list of strings around matches of this regular expression.
Splits the input CharSequence to a list of strings around matches of this regular expression.
Splits the input CharSequence to a list of strings around matches of this regular expression.
Splits the input CharSequence to a list of strings around matches of this regular expression.
Splits the input CharSequence to a list of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Splits the input CharSequence to a sequence of strings around matches of this regular expression.
Returns the string representation of this regular expression, namely the pattern of this regular expression.
Returns the string representation of this regular expression, namely the pattern of this regular expression.
Returns the string representation of this regular expression, namely the pattern of this regular expression.
Returns the string representation of this regular expression, namely the pattern of this regular expression.