[Javascript] RegExp question

Golden Troll gtroll at qwest.net
Thu Dec 13 16:47:24 CST 2001


what about adding a / before course in the expression?
I'm still learn RegExp but the JavaScript Bible has been a great
resource Chap 30 on the accompanying CD is about the best explanation of
the I've seen

If you don't have it a js programmer you should
http://www.amazon.com/exec/obidos/ASIN/0764533428/goldentrollventu/
The gold edition:
http://www.amazon.com/exec/obidos/ASIN/0764547186/goldentrollventu/
Peace and Respects,
Scott Gahres
Owner
Golden Troll four20 Ventures hemp at goldentroll.com
http://goldentroll.com


-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Christopher Basken
Sent: Thursday, December 13, 2001 2:32 PM
To: javascript at LaTech.edu
Subject: [Javascript] RegExp question


Hi,

I've got a page with a bunch of form elements on it.  A bunch of
elements
are named "course_01_02" or "course_12_01" and so on.  I want to loop
through them and yank out the values of these elements, but since I also
need to know the digits, I need to match the numbers (not just the
beginning
"course").

I've got this function:

function FormValidation(theForm) {

    for (var i = 0; i < theForm.length; i++) {
        var e = theForm.elements[i].name;
        var pattern = new RegExp("course_(\d+)_\d+","ig");
        alert(e.match(pattern)); // test
    }

}

But it keeps coming up Null.  According to the documentation at
developer.netscape.com, this should work.

Any thoughts?

Thanks!

Chris


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list