>
> var pattern:RegExp = new RegExp('^' + testID + ".$");
>
should work.thomas --- http://www.web-attitude.fr/ msn : [email protected] softphone : sip:[email protected] <sip%[email protected]> téléphone portable : +33601 822 056 2009/6/9 fumeng5 <[email protected]> > > > Hi, > > I have a filter function for an array collection that I'm working with. In > this scenario, I start with an ID such as '1'. Based on that, I want to > return '1_1', '1_2', etc... Basically, an underscore followed by 1 digit. > > Here's the code: > > var currentID:String = item.id.toString(); // i.e. 1_1, 1_2, etc.. > var testID:String = buttonID + '_'; // buttonID would equal 1 > var pattern:RegExp = new RegExp('^' + testID + "."); > > if( pattern.exec( currentID )) > return true; > else > return false; > > The problem is that this filter is also returning other IDs such as > '1_1_2', '1_1_3'. I thought the '.' would limit it 1 character only after > the underscore. > > Can anyone see where I may be going wrong? > > Thank you! > > >

