I am validating for RegEx errors -- how can I return which keyword, it failed on?

Posted by Trip on Stack Overflow See other posts from Stack Overflow or by Trip
Published on 2011-01-13T13:52:55Z Indexed on 2011/01/13 13:53 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

I'm passing new objects through this set of regex :

(?i)exp\s|(?i)expire\s|(?i)print|(?i)mention|(?i)spring|(?i)summer|(?i)winter|(?i)jan(\s|\.)|(?i)january|(?i)february|(?i)feb(\.|\s)|(?i)march|mar(\.|\s)|(?i)april|(?i)june|(?i)july|(?i)august|(?i)aug(\s|\.)|(?i)september|(?i)sept(\.|\s)|(?i)november|(?i)nov(\.|\s)|(?i)december|(?i)dec(\.|\s)|(?i)holiday|(?i)christmas|(?i)holloween|(?i)easter|(?i)season|(?i)ends|(?i)end

If it errors, for example on the word christmas , how can I dynamically pull the word it errors on, and display it as the cause of the error?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby