|
Groovy JDK |
Method Summary | |
---|---|
Matcher
|
each(Closure closure)
Process each matched substring of the given group matcher passed to the closure is an array of strings, matched per a successful match |
Object
|
getAt(int idx)
Support the subscript operator, e For an example using no group match,
For an example using group matches,
For another example using group matches,
|
String
|
getAt(Collection indices)
Allows a List to be used as the indices to be used on a Matcher |
int
|
getCount()
Find the number of Strings matched to the given Matcher |
static Matcher
|
getLastMatcher()
Get the last hidden matcher that system used to do a match |
boolean
|
hasGroup()
Check whether a Matcher contains a group or not |
Iterator
|
iterator()
Retuns an {@link Iterator} which traverses each match |
void
|
setIndex(int idx)
Set the position of the given Matcher to the given index |
long
|
size()
Provide the standard Groovy size() method for Matcher
|
Method Detail |
---|
public Matcher each(Closure closure)
closure
- a closure.
public Object getAt(int idx)
def p = /ab[d|f]/
def m = "abcabdabeabf" =~ p
for (i in 0..
For an example using group matches,
def p = /(?:ab([c|d|e|f]))/
def m = "abcabdabeabf" =~ p
for (i in 0..
For another example using group matches,
def m = "abcabdabeabfabxyzabx" =~ /(?:ab([d|x-z]+))/
m.count.times {
println( "m.groupCount() = " + m.groupCount())
println( " " + it + ": " + m[it] ) // m[it] is a List
}
idx
- an index.
public String getAt(Collection indices)
indices
- a Collection of indices.
public int getCount()
public static Matcher getLastMatcher()
public boolean hasGroup()
true
if matcher contains at least one group.public Iterator iterator()
public void setIndex(int idx)
idx
- the index number.
public long size()
size()
method for Matcher
.
|
Groovy JDK |