RegExp

@native @JSType trait RegExp extends StObject
trait StObject
class Object
trait Any
class Object
trait Matchable
class Any
class RegExp

Value members

Concrete methods

def compile(): RegExp
def exec(string: String): RegExpExecArray | Null

Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.

Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.

Value Params
string

The String object or string literal on which to perform the search.

def test(string: String): Boolean

Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

Returns a Boolean value that indicates whether or not a pattern exists in a searched string.

Value Params
string

String on which to perform the search.

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from
Object
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def toLocaleString(): String
Inherited from
Object
def valueOf(): Any
Inherited from
Object

Concrete fields

@JSName
var `match`: Function1[String, RegExpMatchArray | Null]

Matches a string with this regular expression, and returns an array containing the results of that search.

Matches a string with this regular expression, and returns an array containing the results of that search.

Value Params
string

A string to search within.

val dotAll: Boolean

Returns a Boolean value indicating the state of the dotAll flag (s) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the dotAll flag (s) used with a regular expression. Default is false. Read-only.

val flags: String

Returns a string indicating the flags of the regular expression in question. This field is read-only. The characters in this string are sequenced and concatenated in the following order:

Returns a string indicating the flags of the regular expression in question. This field is read-only. The characters in this string are sequenced and concatenated in the following order:

  • "g" for global
  • "i" for ignoreCase
  • "m" for multiline
  • "u" for unicode
  • "y" for sticky

If no flags are set, the value is the empty string.

val global: Boolean

Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only.

val ignoreCase: Boolean

Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only.

var lastIndex: Double
val multiline: Boolean

Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only.

@JSName
var replace: Function2[String, String, String] & Function2[String, Function2[String, Any, String], String]

Replaces text in a string, using this regular expression.

Replaces text in a string, using this regular expression.

Value Params
replacer

A function that returns the replacement text.

string

A String object or string literal whose contents matching against this regular expression will be replaced

@JSName
var search: Function1[String, Double]

Finds the position beginning first substring match in a regular expression search using this regular expression.

Finds the position beginning first substring match in a regular expression search using this regular expression.

Value Params
string

The string to search within.

val source: String

Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal.

Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal.

@JSName
var split: Function2[String, UndefOr[Double], Array[String]]

Returns an array of substrings that were delimited by strings in the original input that match against this regular expression.

Returns an array of substrings that were delimited by strings in the original input that match against this regular expression.

If the regular expression contains capturing parentheses, then each time this regular expression matches, the results (including any undefined results) of the capturing parentheses are spliced.

Value Params
limit

if not undefined, the output array is truncated so that it contains no more than 'limit' elements.

string

string value to split

val sticky: Boolean

Returns a Boolean value indicating the state of the sticky flag (y) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the sticky flag (y) used with a regular expression. Default is false. Read-only.

val unicode: Boolean

Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular expression. Default is false. Read-only.

Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular expression. Default is false. Read-only.