regex - How do I perform a Javascript match with a pattern that depends on a variable? -
Only the implementation of the check for the match at the beginning of a tag. For example, typing "Photoshop" will not return the tag named "Adobe Photoshop".
By default, search is case-sensitive. I have modified it to move a bit more and to ignore the case:
for (i = 0; i I have modified it again in "Photoshop" to be able to return the user type "Adobe Photoshop". I tried to use the match , but when it exists in a variable pattern, then I can not seem to work on it:
For (i = 0; i & lt; tagsToSearch.length; i ++) {var ctag = jQuery.trim (currentTag.tag); If (tagsToSearch [i] .match ("/" + "+ ctag +" / i ")) {// it never matches, possibly due to variables 'ctag' matches.push (tagsToSearch [i]); }} What is the correct syntax for doing a regex search in this way?
If you want to dynamically in JavaScript, you have to use it I believe That your code looks like this (not sure, but this is not the right general idea):
For (i = 0; i
Comments
Post a Comment