[jQuery] Re: Dissect an ID

2009-08-30 Thread Phil
Hi, thanks for the reply. I love learning new things but this is kind of complicated... I wrote this from what i looked up: var theid=new RegExp('\d+$'); var isthere = theid.exec("ww_1"); console.log(isthere); But all i get is null, any help? thanks again, Phil On Aug 31, 12:06 am, Jorge Godoy

[jQuery] Re: Dissect an ID

2009-08-30 Thread Phil
Thanks for the replys but i have solved it now: var number = ("ww_1").match(/\d/g); On Aug 31, 12:32 am, Charlie Griefer wrote: > There may be a more elegant way, but until it comes along... > > you can .split() the string on the _ character. > > myArray = myString.split('_') > > which in your

[jQuery] Re: Dissect an ID

2009-08-30 Thread Charlie Griefer
There may be a more elegant way, but until it comes along... you can .split() the string on the _ character. myArray = myString.split('_') which in your case would create an array with element 'thisisadiv' at position 0, and '1' at position 1. you could then reference it via myArray[1] On Sun,

[jQuery] Re: Dissect an ID

2009-08-30 Thread Jorge Godoy
I'd math the regex "\d+$", i.e., I'd get numbers at the end of the value. Then you could operate on the matched value. -- Jorge Godoy On Sun, Aug 30, 2009 at 19:29, Phil wrote: > > In jQuery how do I remove a certain part of an id... > > for example i have a div id='thisisadiv_1' > I wan