[Javascript] RegExp question

Christopher Basken chriz at basken.com
Fri Dec 14 09:15:25 CST 2001


Yeah, that's what I ended up doing.

Thanks!


ooooops ! I mean
tabvar = theForm.elements[i].name.value.split("_");

-----Message d'origine-----
De : FERON Matthieu
Envoyé : vendredi 14 décembre 2001 08:49
À : 'javascript at LaTech.edu'
Objet : RE: [Javascript] RegExp question



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 <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
<https://lists.LaTech.edu/mailman/listinfo/javascript>






More information about the Javascript mailing list