The options must
be concatenated in a single string value; the order does not matter.
Before going into details over the definition of patterns, have a look at the following examples to see
how and when the EReg methods and options must be applied.
The matched() method returns the content of a group defined in the expression. In the pattern
b(c)d the group is between the parentheses; the pattern matches if the entire string bcd is present in the
passed string and if this happens, then a group that also contains the c letter exists. Note that the zero
Table 8-4
EReg Method Description
new(r:String, opt:String) Creates an EReg instance. The first argument is a string regex
pattern. The second argument is a string of options.
match(s:String) : Bool Returns true if the regex pattern matches the passed string
argument.
matched(n:Int) : String Returns the matched group with the passed identification number.
This function must be used after a match() execution and
the groups refer to that operation. The group with identification
equal to zero corresponds to the whole match; greater values
correspond to ???groups??? defined in the pattern.
Pages:
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416