scala.util.matching

Regex

object Regex extends Serializable

This object defines inner classes that describe regex matches and helper objects.

Source
Regex.scala
Linear Supertypes
Serializable, java.io.Serializable, AnyRef, Any
Content Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Regex
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class Match extends MatchData

    Provides information about a succesful match.

  2. trait MatchData extends AnyRef

    This class provides methods to access the details of a match.

  3. class MatchIterator extends AbstractIterator[String] with Iterator[String] with MatchData

    A class to step through a sequence of regex matches.

    A class to step through a sequence of regex matches.

    All methods inherited from scala.util.matching.Regex.MatchData will throw a java.lang.IllegalStateException until the matcher is initialized. The matcher can be initialized by calling hasNext or next() or causing these methods to be called, such as by invoking toString or iterating through the iterator's elements.

    See also

    java.util.regex.Matcher

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. object Groups

    An extractor object that yields the groups in the match.

    An extractor object that yields the groups in the match. Using an extractor rather than the original regex avoids recomputing the match.

    import scala.util.matching.Regex.Groups
    
    val datePattern = """(\d\d\d\d)-(\d\d)-(\d\d)""".r
    val text = "The doc spree happened on 2011-07-15."
    val day = datePattern replaceAllIn(text, _ match { case Groups(year, month, day) => month+"/"+day })
  5. object Match

    An extractor object for Matches, yielding the matched string

    An extractor object for Matches, yielding the matched string

    This can be used to help writing replacer functions when you are not interested in match data. For example:

    import scala.util.matching.Regex.Match
    """\w+""".r replaceAllIn ("A simple example.", _ match { case Match(s) => s.toUpperCase })
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  15. final def notify(): Unit

    Definition Classes
    AnyRef
  16. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  17. def quote(text: String): String

    Quotes strings to be used literally in regex patterns.

    Quotes strings to be used literally in regex patterns.

    All regex metacharacters in the input match themselves literally in the output.

    Example:
    1. List("US$", "CAN$").map(Regex.quote).mkString("|").r
  18. def quoteReplacement(text: String): String

    Quotes replacement strings to be used in replacement methods.

    Quotes replacement strings to be used in replacement methods.

    Replacement methods give special meaning to backslashes (\) and dollar signs ($) in replacement strings, so they are not treated as literals. This method escapes these characters so the resulting string can be used as a literal replacement representing the input string.

    text

    The string one wishes to use as literal replacement.

    returns

    A string that can be used to replace matches with text.

    Example:
    1. "CURRENCY".r.replaceAllIn(input, Regex quoteReplacement "US$")
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def toString(): String

    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from java.io.Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped