Core API – Kotlin Programming Language (original) (raw)

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.0

Represents 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.1

Represents 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.0

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 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.3

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 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.8

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 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.8

expect constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

actual constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

actual constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

actual constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

actual constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

actual constructor(pattern: String)

Creates a regular expression from the specified pattern string and the default options.

Creates a regular expression from the specified pattern string and the specified single option.

Creates a regular expression from the specified pattern string and the specified set of options.

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.

The pattern string of this regular expression.

The pattern string of this regular expression.

The pattern string of this regular expression.

The pattern string of this regular expression.

The pattern string of this regular expression.

The pattern string of this regular expression.

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 a regular expression exactly at the specified index in the input char sequence.

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.

Checks if a regular expression matches a part of the specified input char sequence exactly at the specified index.

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 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 an instance of Pattern with the same pattern string and options as this instance of Regex has.

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.

Returns the string representation of this regular expression, namely the pattern of this regular expression.

Thanks for your feedback!