Home | Table of Contents | Regular Expressions | CloverETL 4.6.1
--- | --- | ---
Prev | Language Reference | Next

## Regular Expressions

A regular expression is a formalism used to specify a set of strings with a single expression. Since the implementation of regular expressions comes from the Java standard library, the syntax of expressions is the same as in Java: see http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html.

Example 59.27. Regular Expressions Examples

`[p-s]{5}`

- means the string has to be exactly five characters long and it can only contain the `p`, `q`, `r` and `s` characters

`[^a-d].*`

- this example expression matches any string which starts with a character other than `a`, `b`, `c`, `d` because

  - the `^` sign means exception

  - `a-d` means characters from `a` to `d`

  - these characters can be followed by zero or more (`*`) other characters

  - the dot stands for an arbitrary character

For more detailed explanation of how to use regular expressions see the Java documentation for `java.util.regex.Pattern`.

The meaning of regular expressions can be modified using embedded flag expressions. The expressions include the following:

`(?i)` – `Pattern.CASE_INSENSITIVE`
  Enables case-insensitive matching.
`(?s)` – `Pattern.DOTALL`
  In dotall mode, the dot `.` matches any character, including line terminators.
`(?m)` – `Pattern.MULTILINE`
  In multiline mode you can use `^` and `$` to mean the beginning and end of the line, respectively (that includes at the beginning and end of the entire expression).

Further reading and description of other flags can be found at http://docs.oracle.com/javase/tutorial/essential/regex/pattern.html.

Prev | Up | Next
Parameters | Home | Table of Contents | CTL Debugging