[Javascript] RegExp question

Christopher Basken chriz at basken.com
Thu Dec 13 18:57:42 CST 2001


Nope, neither.

Thanks anyway!

> try
> var pattern = new RegExp("/course\_/(/d+)\_/d+/ig");
> or
> var pattern = new RegExp("/course\_(/d+)\_/d+/ig");
> 
> 
> 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 3:27 PM
> To: javascript at LaTech.edu
> Subject: Re: [Javascript] RegExp question
> 
> 
> Hm...
> 
> var pattern = new RegExp("course\_(\d+)\_\d+","ig");
> 
> Nope, same results.  I also tried it with the / before course and stuff.
> 
> 
> > how about escaping the under_score \_
> >
> > -----Original Message-----
> > From: javascript-admin at LaTech.edu
> [mailto:javascript-admin at LaTech.edu]On
> > Behalf Of Christopher Basken
> > Sent: Thursday, December 13, 2001 3:05 PM
> > To: javascript at LaTech.edu
> > Subject: Re: [Javascript] RegExp question
> >
> >
> > I tried that, with...
> >
> > var pattern = new RegExp("/course_/(\d+)_\d+","ig");
> >
> > ...and...
> >
> > var pattern = new RegExp("/course_(\d+)_\d+/","ig");
> >
> > ...neither seems to work.
> >
> >
> > > 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
> > >
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at LaTech.edu
> > > https://lists.LaTech.edu/mailman/listinfo/javascript
> > >
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 




More information about the Javascript mailing list