I have a list of phone numbers in either a (###)###-#### of
###-###-#### type format. There is also a text box that on change
filters array collection that populates the list. The code breaks down to.

private function phoneFilter(item:Object):Boolean
{
if(item.Phone.search(searchBar.text) >= 0)
{return true;}
else
{return false;}
}

the 5 phone numbers that i randomly put in the collection are are
#1)"123-456-7890"
#2)null
#3)"(403)734-4312"
#4)"(780)495-4949"
#5)"(780)828-4229"

the #1 and #2 phone number filters as expected however the ones with
the brackets are awkward.
"(", "(780", "780)", "(780)828" fail not as I expected
"(780)", "780" succeed as I expected

And tossing in random "*" succeed definitely not as I had expected
"(780)*82" matches #5
"(780)*8" or even "780*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*" matches
#4, #5, and #1
"(780)*", or "(spam)*" match all 5 numbers
even "()*" or "(###)*" where # is any 3 numbers and it matches all 5
numbers again even the null.
even "(828)" matches #5 or similar ideas

Obviously the "(", ")" and "*" characters are doing something strange
to the search() function. Hopefully someone can explain why I'm seeing
this behavior with these characters or a way to change how I'm
filtering the phone numbers to get somewhat normal behavior.

Reply via email to