Search button filter

Hi all,

i am building a search filter into my button. when i press it i want it to remove all the words that don't match and only keep the one that matches. this is in Javascript.

any idea how i can do this?

thanks for any help

Have an array of strings, and filter them out using regular expressions.

http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx

For instance, if you had this list:

  • apple
  • apartment
  • dog
  • market
  • snap

and you typed in "ap", using the regular expression:

.*ap.*

it would find the following matches:

  • apple
  • apartment
  • snap

The RegEx class can be found in the `System.Text.RegularExpressions` namespace.