I just want to create a regular expression out of any possible string.  var usersString = "Hello?!*`~World()[]"; var expression = new RegExp(RegExp.escape(usersString)) var matches = "Hello".match(expression);   Is there a built in...
What is the problem with this regular expression when I use the global flag and the case insensitive flag? Query is a user generated input. The result should be [true, true].  var query = 'Foo B'; var re = new RegExp(query, 'gi'); v...
I would like to create a String.replaceAll() method in JavaScript and I'm thinking that using a regex would be most terse way to do it.  However, I can't figure out how to pass a variable in to a regex.  I can do this already which will rep...
I want to match a portion of a string using a regular expression and then access that parenthesized substring:  var myString = "something format_abc"; // I want "abc"  var arr = /(?:^|\s)format_(.*?)(?:\s|$)/.exec(myString);  co...
In the regex below, \s denotes a space character.  I imagine the regex parser, is going through the string and sees \ and knows that the next character is special.  But this is not the case as double escapes are required.  Why is this?  var res = n...
How can I use Unicode-aware regular expressions in JavaScript? For example, there should be something akin to \w that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctu...
Is there a way to achieve the equivalent of a negative lookbehind in javascript regular expressions?  I need to match a string that does not start with a specific set of characters.  It seems I am unable to find a regex that does this without faili...
I want a regular expression to check that:  A password contains at least eight characters, including at least one number and  includes both lower and uppercase letters and special characters, for example #, ?, !.  It cannot be your old password or...
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.  I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know...
How do I split a string with multiple separators in JavaScript?  I'm trying to split on both commas and spaces but, AFAIK, JS's split function only supports one separator....

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.