aspose file tools*
The moose likes Groovy and the fly likes GinA Example - Can anyone explain how it works Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "GinA Example - Can anyone explain how it works" Watch "GinA Example - Can anyone explain how it works" New topic
Author

GinA Example - Can anyone explain how it works

Kristian Jones
Greenhorn

Joined: Jun 26, 2008
Posts: 6
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

Joined: Aug 29, 2007
Posts: 77
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


Author of Grails: A Quick-Start Guide
Kristian Jones
Greenhorn

Joined: Jun 26, 2008
Posts: 6
Doh, school boy error. Can't believe I didn't check the pattern first.


Thanks again.
Kris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GinA Example - Can anyone explain how it works
 
Similar Threads
Replace text by HTML links
First hand at RegEx
Seemingly simple regex making my head hurt
Pattern Matching
i am validating email on server side