Linked Questions

642 votes
21 answers
215k views

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 = "...
Lance Pollard's user avatar
0 votes
1 answer
143 views

For a message in a specific message format (HL7) I'm trying to escape the ^ sign. So the string abc^def^ghi should become abc\^def\^ghi I tried the following ways: > "abc^def^ghi".replace("^", "\^...
kramer65's user avatar
  • 54.5k
-5 votes
2 answers
83 views

Sorry, this sounds very basic, but I really can't find on Google. In order to replace contents in a string globally, you can use things like... a.replace(/blue/g,'red') But sometimes you need to ...
Marco Jr's user avatar
  • 6,848
36 votes
5 answers
59k views

I have managed to set up a search feature in my mongodb app. See the code below. This works very well however it only returns exact results. How would I change my code to make it accept more "fuzzy" ...
AndrewLeonardi's user avatar
18 votes
3 answers
77k views

I was wondering how would you escape special characters in nodejs. I have a string $what$ever$ and I need it escaped like \$what\$ever\$ before i call a python script with it. I tried querystring npm ...
waka-waka-waka's user avatar
6 votes
5 answers
15k views

I've made this regex: ^[a-zA-Z0-9_.-]*$ Supports: letters [uppercase and lowercase] numbers [from 0 to 9] underscores [_] dots [.] hyphens [-] Now, I want to add these: spaces [ ] comma [,] ...
youmotherhaveapples's user avatar
2 votes
2 answers
5k views

I am trying to find if a value stored in dynamic variable is inside of an array while ignoring case and not using to .toLowerCase() or upper. What I have that works is: if ($scope.favoriteItems....
RooksStrife's user avatar
  • 1,747
1 vote
3 answers
9k views

I don't know why but I can't escape special characters in patterns. If StrTest Like "\[*\]" Then ... It still does not match values like [1234567890]. In other threads I read that "\" is used to ...
Flo Gaede's user avatar
0 votes
6 answers
1k views

my code is like that.. function replaceAll(str, from, to) { let result = '' for(let i = 0 ; i < str.length ; i++) if(str[i]===from) { result = str.replace(from,to) } } ...
Loolii's user avatar
  • 455
0 votes
7 answers
5k views

Here is my code And I am trying to change the color of any match in the <li> elements that matches the text in the <input> element. So if you type lets say "this is a simple text" the ...
Nassim's user avatar
  • 2,876
0 votes
3 answers
2k views

When an user inputs a string that only contains one parenthesis, the Regex.IsMatch() breaks. Inputting a single [ also breaks the program. Regex.IsMatch("John Cena", "Test(", RegexOptions.IgnoreCase) ...
MortenMoulder's user avatar
2 votes
1 answer
3k views

I am trying to build real-time search project but i am not sure what wrong with my code. if i search "AAA - AAA" a results is show but when i search "TOF0042 - text update + resize" a results not show ...
Vuthy Sok's user avatar
  • 740
2 votes
2 answers
2k views

I came across this pen at codePen, and found a bug. If you type in the following chars in the searchbox: ), (, [, +, \, *, ? I get the following error (I entered each char separately): I think the ...
Horay's user avatar
  • 1,408
1 vote
2 answers
4k views

Suppose I have a list formed by words including special characters: one <two></two> three# $four etc. I want to find all words in the list that contain specific letters, I've tried to use ...
user avatar
1 vote
2 answers
3k views

I have words to match using only a single pattern. The criteria are one of the following: it contains a number or an underscore at the first letter, OR at least one special character (excluding ...
Manu's user avatar
  • 45

15 30 50 per page