Jump to content

string search


Guest paritosh1010

Recommended Posts

Guest paritosh1010
Example 2 - Case-insensitive SearchIn the following example we will perform a case-insensitive search:<script type="text/javascript">var str="Visit W3Schools!"document.write(str.search(/w3schools/i))</script>

The output of the code above will be:6here, w3schools inside search argument is a string. what if u want to use a variable there, that has w3schools stored in it?lets say variable name was s/s/i wont work, since it treats the thing as a string(s)i wont work either/(s)/i eitherany suggestions? :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...