RegExp does not match

Hi,
When I try this on IRB it works fine as follows:

/\A[\w±.!#$%&’/=?^{|}~]+@[a-z\d\-.]+\.[a-z]+\z/.match("jd!#$\%&'*+-/=?^_{|}[email protected]")
=> #<MatchData "jd!%&'
±/=?^_`{|}[email protected]">

When I try it through my Ruby on Rails program I get a nil. Any idea
what is
happening? I am of course trying to validate an email syntax.
The regex is /\A[\w±.!#$%&’*/=?^{|}~]+@[a-z\d\-.]+\.[a-z]+\z/ The data to match is jd!#$\%&'*+-/=?^_{|}[email protected]

Any help greatly appreciated.

On Thursday, May 12, 2011 1:10:16 PM UTC-6, Ruby-Forum.com User wrote:

happening?

I think the follow-up question we all have is what do you specifically
mean
by “when I try it through by Ruby on Rails program.”

In other words, what is the context or surrounding code in which you
“try
it” within your rails app? This likely has a large bearing on any answer
anyone can give you. I just ruled out the possibility of it being a
variations in ruby versions (RVM is handy for that). Specifically, it
works
using irb (just as you said) in jruby (1.5.3), ree (2010.02), 1.8.7-p302
and
1.9.2-p0. It even works in 1.8.6-p399 and 1.9.1-p378.

That leaves rails context. We need code!