Groovy - Regular Expressions - 0 views
-
Groovy supports regular expressions natively using the ~"pattern" expression
- ...6 more annotations...
-
Since a Matcher coerces to a boolean by calling its find method, the =~ operator is consistent with the simple use of Perl's =~ operator, when it appears as a predicate (in 'if', 'while', etc.). The "stricter-looking" ==~ operator requires an exact match of the whole subject string.
-
def matcher = "\$abc." =~ /\$(.*)\./ // no need to double-escape! assert "\\\$(.*)\\." == /\$(.*)\./ matcher.matches(); // must be invoked assert matcher.group(1) == "abc" // is one, not zero
-
// lets create a Matcher def matcher = "cheesecheese" =~ /cheese/ assert matcher instanceof Matcher answer = matcher.replaceAll("edam")
-
-
// fancier group demo matcher = "\$abc." =~ "\\\$(.*)\\." matcher.matches(); // must be invoked [Question: is this still true? Not in my experience with jsr-04.] assert matcher.group(1) == "abc" // is one, not zero
-
You nbelom know this one, please visit soonclick this link now .. !!! http://www.agenherbalnasa.com/2017/04/harga-ayla-breast-care.html http://www.agenherbalnasa.com/2017/04/harga-collaskin-facial-cleanser.html http://www.agenherbalnasa.com/2016/11/harga-crystal-x-asli-nasa.html http://www.agenherbalnasa.com/2017/04/harga-glio-nasa.html http://www.agenherbalnasa.com/2017/04/pestona.html
~"pattern" (create java.util.regex.Pattern)=~ (create java.util.regex.Matcher)==~ (do Matcher.matches() )