Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Newbie needs help with regex

Cafebabe

2008-08-08

Replies: Find Java Web Hosting

Author LoginPost Reply

I'm not new to regex, but new to Groovy. Please help, why won't the following
code match what I want?

The valid characters are A-Z, a-z, spaces, period, comma, apostrophe,
hyphen. I want to disqualify anything else.

I started with a simple regex to allow alpha only, but
even that is not working for me. What the heck am I doing wrong??

// mmn = String from posted form

// should match anything that is not alpha
matcher = ( mmn =~ /[^A-Za-z\ \.,'-]/ );
if (matcher.matches()) { //return error message}

--
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


©2008 gg3721.com - Jax Systems, LLC, U.S.A.