[Javascript] RegExp question

FERON Matthieu FERONMA at cic-i.com
Fri Dec 14 01:48:47 CST 2001


and what about
tabvar = document.forms.name.split("_");
so you get tabvar[1] and tabvar[2] with the values

-----Message d'origine-----
De : Christopher Basken [mailto:chriz at basken.com]
Envoyé : jeudi 13 décembre 2001 23:32
À : javascript at LaTech.edu
Objet : [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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20011214/a296b4a0/attachment.htm>


More information about the Javascript mailing list