the MMM blog

JQuery Selector Wildcard and Regular Expression

JQuery Selector Wildcard and Regular Expression

JQuery selector is similar with CSS selector, but at some point, you might need to use wildcard or regular expression to do more specific selections. The followings are some examples show you how to use them.

string Equals

// example
<input name="inputname">

string Contrains

// example
<input name="123inputname123">

string Starts with

// example
<input name="inputname123">

string Ends with

// example
<input name="123inputname">

string Does not equal to

// example
<input name="anything">

string Contains prefix (followed by a hyphen -)

// example
<input name="inputname-123">

string Contains (separated by a space)

// example
<input name="inputname anothername">


If the above wildcards selector still doesn't meet your needs, you can try the following regular expression selector to select whatever you need.

$('input').filter(function() {
   return regular expression here/);




"If opportunity doesn't knock, build a door"

Contact me!

Have questions? Feel free to use the form or send me an email with any questions.

I will be responsive to your requests and your questions.