I want to use JavaScript (can be with jQuery) to do some client-side validation to check whether a string matches the regex:  ^([a-z0-9]{5,})$   Ideally it would be an expression that returned true or false.   I'm a JavaScript newbie, does matc...
Is there a way to retrieve the (starting) character positions inside a string of the results of a regex match() in Javascript?...
Consider the following example:  <html> <body>  <script type="text/javascript">  var str="filename.jpg";  var pattOne = new RegExp('\.[^\.]*$'); var pattTwo = new RegExp('(\.[^\.]*$)'); var pattThre...
I have a textarea, and when I write, for example, "want", I want to replace it with "two".   How can I match and replace whole words in javascript?...
I would like to know how to match a string against an array of regular expressions. I know how to do this looping through the array. I also know how to do this by making a long regular expression separated by | I was hoping for a more efficient way l...
I have two multidimensional arrays:  first is something like (['one','one','three'],['four','five',five'],['one','one','one'])  and the second one is like this (['one','o...
I'm trying to figure out how to match the following strings:  blaOSXbla os X bla bla os-x blablaOS_Xbla   A common pattern is pretty easy: /(osx|os x|os-x|os_x)/i.test(string)  The task is to minimize it as much as possible. So my next step is  /...
I've read some other questions and answers on the site, but all of them were a little different from what I'm seeking: replace all tabs at the beginning of a string with four spaces.  What I've tried so far:  let m = '\t\tsomething\t&...
I have this regex variable:  var regexp = new RegExp(RegExp.quote(myExpression) + '\\b', 'g');   which searches for expression that has a space after it. (RegExp.quate() I got from this How to escape regular expression in javascript?)...
I have the following URL:  http://example.com/product/1/something/another-thing  Although it can also be:  http://test.example.com/product/1/something/another-thing  or  http://completelydifferentdomain.tdl/product/1/something/another-thing  And I wa...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.