This module provides basic cross-platform regular expression support. It's based on Google's RegExp object for GWT.
For documentation pertaining to regular expressions and patterns take a look at the information for the original implementations:
A simple example of how to use this module:
Regex re = regex("[0-9]+ years"); assert(re.test("90 years old")); print(re.replace("90 years old", "very"));
Packages | |
ceylon.regex |
Dependencies | ||
java.base (jvm) | 7 |
Functions | |
quote | Source Codeshared String quote(String input) This method produces a Parameters:
|
regex | Source Codeshared Regex regex(String expression, Boolean global = false, Boolean ignoreCase = false, Boolean multiLine = false) Factory method that returns an initialized Parameters:
Throws |
Classes | |
MatchResult | Source Codeshared MatchResult The result of a call to |
Regex | Source Codeshared abstract sealed Regex A class for cross-platform regular expressions modeled on Javascript's
Example usage: Regex re = regex("[0-9]+ years"); assert(re.test("90 years old")); print(re.replace("90 years old", "very")); There are a few small incompatibilities between the two implementations. Java-specific constructs in the regular expression syntax (e.g. [a-z&&[^bc]], (?<=foo), \A, \Q) work only on the JVM backend, while the Javascript-specific constructs $` and $' in the replacement expression work only on the Javascript backend, not the JVM backend, which rejects them. There are also sure to exist small differences between the different browser implementations, be sure to test thoroughly, especially when using more advanced features. |
Exceptions | |
RegexException | Source Codeshared RegexException An exception that can be thrown when the |