• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GinA Example - Can anyone explain how it works

 
Kristian Jones
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
The following code is a modified example from Groovy in Action but I don't understand what it does.




I never seem to be able to get the 'matched candidate with regex' (which is what I think the code is supposed/!supposed to do) regardless of how I change the 1st / 3rd argument. Has anyone got any suggestions on what needs to be changed in order to make it work and print out this line.

The code is from page 165 of the book and I'm using groovy 1.6.5

Thanks
Kris
 
Dave Klein
author
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you had a couple minor errors in the regex:

GinA page 165 code has this:
and your example has this:
Notice the sequence: ".[a-zA" from GinA. Your example has ".=a-za"

I hope that helps,
Dave
 
Kristian Jones
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doh, school boy error. Can't believe I didn't check the pattern first.


Thanks again.
Kris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic