class RegExp extends Object
The RegExp constructor creates a regular expression object for matching text with a pattern.
MDN
- Alphabetic
- By Inheritance
- RegExp
- Object
- Any
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (RegExp, B)
- final def ==(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def ensuring(cond: (RegExp) => Boolean, msg: => scala.Any): RegExp
- def ensuring(cond: (RegExp) => Boolean): RegExp
- def ensuring(cond: Boolean, msg: => scala.Any): RegExp
- def ensuring(cond: Boolean): RegExp
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exec(string: String): ExecResult
The exec() method executes a search for a match in a specified string.
The exec() method executes a search for a match in a specified string. Returns a result array, or null.
If you are executing a match simply to find true or false, use the RegExp.test() method or the String.search() method.
If the match succeeds, the exec method returns an array and updates properties of the regular expression object. The returned array has the matched text as the first item, and then one item for each capturing parenthesis that matched containing the text that was captured.
If the match fails, the exec method returns null.
MDN
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def formatted(fmtstr: String): String
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val global: Boolean
The value of global is a Boolean and true if the "g" flag was used; otherwise, false.
The value of global is a Boolean and true if the "g" flag was used; otherwise, false. The "g" flag indicates that the regular expression should be tested against all possible matches in a string.
MDN
- def hasOwnProperty(v: String): Boolean
Tests whether this object has the specified property as a direct property.
Tests whether this object has the specified property as a direct property.
Unlike js.Object.hasProperty, this method does not check down the object's prototype chain.
MDN
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val ignoreCase: Boolean
The value of ignoreCase is a Boolean and true if the "i" flag was used; otherwise, false.
The value of ignoreCase is a Boolean and true if the "i" flag was used; otherwise, false. The "i" flag indicates that case should be ignored while attempting a match in a string.
MDN
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
Tests whether this object is in the prototype chain of another object.
Tests whether this object is in the prototype chain of another object.
- Definition Classes
- Object
- var lastIndex: Int
The lastIndex is a read/write integer property of regular expressions that specifies the index at which to start the next match.
The lastIndex is a read/write integer property of regular expressions that specifies the index at which to start the next match.
MDN
- val multiline: Boolean
The value of multiline is a Boolean and is true if the "m" flag was used; otherwise, false.
The value of multiline is a Boolean and is true if the "m" flag was used; otherwise, false. The "m" flag indicates that a multiline input string should be treated as multiple lines. For example, if "m" is used, "^" and "$" change from matching at only the start or end of the entire string to the start or end of any line within the string.
MDN
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def propertyIsEnumerable(v: String): Boolean
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
If the object does not have the specified property, this method returns false.
MDN
- Definition Classes
- Object
- val source: String
The source property returns a String containing the text of the pattern, excluding the forward slashes.
The source property returns a String containing the text of the pattern, excluding the forward slashes. It is a read-only property of an individual regular expression instance. source does not contain any flags (like "g", "i" or "m") of the regular expression.
MDN
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def test(string: String): Boolean
The test() method executes a search for a match between a regular expression and a specified string.
The test() method executes a search for a match between a regular expression and a specified string. Returns true or false.
You can use test() whenever want to know whether a pattern is found in a string (similar to the String.search method); for more information (but slower execution) use the exec method (similar to the String.match method). As with exec (or in combination with it), test called multiple times on the same global regular expression instance will advance past the previous match.
MDN
- def toLocaleString(): String
- Definition Classes
- Object
- def toString(): String
- Definition Classes
- AnyRef → Any
- def valueOf(): scala.Any
- Definition Classes
- Object
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def →[B](y: B): (RegExp, B)
- Implicit
- This member is added by an implicit conversion from RegExp toArrowAssoc[RegExp] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.