haXe API Documentation
Back | Index
class EReg
Available in flash8, neko, js, flash, php, cpp

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

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 map(s : String, f : EReg -> String) : String
function match(s : String) : Bool
function matchSub(s : String, pos : Int, ?len : Int) : Bool
function matched(n : Int) : String
function matchedLeft() : String
function matchedPos() : { pos : Int, len : Int}
function matchedRight() : String
function replace(s : String, by : String) : String
function split(s : String) : Array<String>
Back | Index