Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

'Bad Escapement' on line declaring RegEx

the line declaring a RegEx for checking an email:

var rgx = RegExp("/^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$/");

is throwing a warning during Titanium building process

[WARN] JavaScript compiler reported "Bad escapement." at pages/login_form.js:51

any tips on how to get it to stop? I know it's just a warning, but warnings mean "bad code" and i don't want to pick up any bad habits

— asked April 21st 2010 by Stephen Gilboy
  • iphone
  • regex
0 Comments

1 Answer

  • hmm.. switching to "literal" format worked

    var rgx = /^([a-zA-Z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-zA-Z0-9-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$/;

    no warning for that

    — answered April 21st 2010 by Stephen Gilboy
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.