Terminating a variable assignment...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Susan

    Terminating a variable assignment...

    Hi all,

    I have the following variable assignments in a script:

    var strEmail = document.new_re cord.email.valu e;
    var strJob = document.new_re cord.occupation .value;
    var strNumbers = ^[0-9]\d{2}-\d{3}-\d{4}$
    var strMatch = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/

    ....my question is, how do I terminate the regular expression assignments (strNumbers and strMatch)?
    Do I simply add a ";" as with the first two assignment? Or, will the ";" confuse the regular
    expressions?

    TIA,

    Susan
  • Michael Winter

    #2
    Re: Terminating a variable assignment...

    On Sat, 01 May 2004 16:37:04 GMT, Susan <SusanL@bfd.net > wrote:
    [color=blue]
    > I have the following variable assignments in a script:
    >
    > var strEmail = document.new_re cord.email.valu e;
    > var strJob = document.new_re cord.occupation .value;
    > var strNumbers = ^[0-9]\d{2}-\d{3}-\d{4}$
    > var strMatch = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3 })+$/
    >
    > ...my question is, how do I terminate the regular expression assignments
    > (strNumbers and strMatch)? Do I simply add a ";" as with the first two
    > assignment? Or, will the ";" confuse the regular expressions?[/color]

    Yes, you just append a semi-colon (;). However, strNumbers isn't assigned
    a regular expression (it should be a syntax error): you forgot to surround
    the text with forward slashes (/).

    Hope that helps,
    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    Working...