class EReg

Available on all platforms

The EReg class represents regular expressions.

While basic usage and patterns consistently work across platforms, some more complex operations may yield different results. This is a necessary trade- off to retain a certain level of performance.

EReg instances can be created by calling the constructor, or with the special syntax ~/pattern/modifier

EReg instances maintain an internal state, which is affected by several of its methods.

A detailed explanation of the supported operations is available at http://haxe.org/doc/cross/regexp

Instance Fields

function new(r:String, opt:String):Void

Creates a new regular expression with pattern r and modifiers opt.

This is equivalent to the shorthand syntax ~/r/opt

If r or opt are null, the result is unspecified.

function split(s:String):Array<String>

Splits String s at all substrings this EReg matches.

If a match is found at the start of s, the result contains a leading empty String "" entry.

If a match is found at the end of s, the result contains a trailing empty String "" entry.

If two matching substrings appear next to each other, the result contains the empty String "" between them.

By default, this method splits s into two parts at the first matched substring. If the global g modifier is in place, s is split at each matched substring.

If s is null, the result is unspecified.