Created
July 8, 2015 20:27
-
-
Save JavaScript-Packer/6fab628f0d147a6b58b1 to your computer and use it in GitHub Desktop.
Tiny minified JavaScript function to find out if a string contains a search word/tern using regex. Live demo on http://jsfiddle.net/apmepe5j/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_in(a,b,c,d){return c=RegExp(b),d=c.test(a)} | |
alert(is_in("WHAK.com's awesome haystack!","needle")); | |
//returns false | |
alert(is_in("WHAK.com's awesome haystack!","some")); | |
//returns true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment