Groovy web console

subscribe to the feed Subscribe
to this
site

Pattern matcher test

Published 1 month ago by Ben
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.regex.Pattern

Pattern p = Pattern.compile( /f\.[A-Za-z0-9_]+/ )
String s = " c.d d.e e.f f.g g.h f.f h.i "

println (s =~ p)

for (String t in (s =~ p)) {
  println t
}