Is there a way to retrieve the (starting) character positions inside a string of the results of a regex match() in Javascript?...
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 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...
Given two strings, how can I do something if both strings have one word in common?  For example: "foo bar" and "foo line" both have the word "foo". The strings could be 3 words long or more, like "foo bar" and "blu...
The current implementation of Remy Sharp's jQuery tag suggestion plugin only checks for matches at the beginning of a tag. For example, typing "Photoshop" will not return a tag named "Adobe Photoshop".  By default, the search is c...
I have a long string in javascript like  var string = 'abc234832748374asdf7943278934haskhjd';  I am trying to match like   abc234832748374 - that is - I have tried like  string.match(\abc[^abc]|\def[^def]|) but that doesnt get me both strings...