Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder ninnypants's Avatar
    Join Date
    Apr 2008
    Location
    Utah
    Posts
    504
    Thanks
    10
    Thanked 47 Times in 47 Posts
    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

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Hi lisali, always use [code][/code] tags to wrap your code while posting here, you may edit your post too.

    PS:welcome to CF
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •