Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-27-2008, 11:23 PM   PM User | #1
lisali
New to the CF scene

 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
lisali is an unknown quantity at this point
Exclamation Please help with an expression that throws a Fatal error...

Hello,

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:

Code:
  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
Code:
'
after the second
Code:
a-z0-9,
after
Code:
!#\$%&
and just before the
Code:
\
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!



Lisa

Last edited by lisali; 09-28-2008 at 12:26 PM..
lisali is offline   Reply With Quote
Old 09-28-2008, 07:02 AM   PM User | #2
ninnypants
Regular Coder

 
ninnypants's Avatar
 
Join Date: Apr 2008
Location: Utah
Posts: 504
Thanks: 10
Thanked 47 Times in 47 Posts
ninnypants is an unknown quantity at this point
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
ninnypants is offline   Reply With Quote
Old 09-28-2008, 09:15 AM   PM User | #3
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Hi lisali, always use [code][/code] tags to wrap your code while posting here, you may edit your post too.

PS:welcome to CF
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 09-28-2008, 12:33 PM   PM User | #4
lisali
New to the CF scene

 
Join Date: Sep 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
lisali is an unknown quantity at this point
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!
lisali is offline   Reply With Quote
Reply

Bookmarks

Tags
error, javascript, minify, prototype, validation

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:18 AM.


Advertisement
Log in to turn off these ads.