469,934 Members | 2,075 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

Terminating a variable assignment...

Hi all,

I have the following variable assignments in a script:

var strEmail = document.new_record.email.value;
var strJob = document.new_record.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
Jul 23 '05 #1
1 1088
On Sat, 01 May 2004 16:37:04 GMT, Susan <Su****@bfd.net> wrote:
I have the following variable assignments in a script:

var strEmail = document.new_record.email.value;
var strJob = document.new_record.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?


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.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

83 posts views Thread by Alexander Zatvornitskiy | last post: by
15 posts views Thread by Robert Sturzenegger | last post: by
134 posts views Thread by James A. Donald | last post: by
166 posts views Thread by Graham | last post: by
23 posts views Thread by Russ Chinoy | last post: by
9 posts views Thread by NevilleDNZ | last post: by
4 posts views Thread by siddhu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.