View Full Version : Please help with an expression that throws a Fatal error...

09-28-2008, 12:23 AM

I am trying to use Minify to dynamically minify and compress some javascripts. However, one of them causes a Fatal error, and I have pinpointed the problem to this regular expression, and I even know which symbol is causing it - but I really know nothing about Javascript, so could really use some help.

The code throwing the error is:

return Validation.get('IsEmpty').test(v) || /^[a-z0-9,!\#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})/i.test(v)

And the symbol causing all the problems is the
' after the second
a-z0-9, after
!#\$%& and just before the

Now - why does this work on its own, but goes crazy if I try to minify it? Can I adjust something to make it play nice?

Many thanks!



09-28-2008, 08:02 AM
if it's email validation you should probably just get rid of it but if not you can add a slash '\' in front of it

09-28-2008, 10:15 AM
Hi lisali, always use
][/COLOR] tags to wrap your code while posting here, you may edit your post too.

PS:welcome to CF

09-28-2008, 01:33 PM
Hi there,

Many thanks for your reply.

I believe it is an email validation, and I kind of need it.

Sorry - when you say to add a slash in front - do you mean in front of the line or in front of the ' that is causing the problems?

If I just remove the ' it seems to work fine, but I do not know what removing it actually does and if it will mess something up.

Many thanks!