Linked Questions

-3 votes
2 answers
14k views

I'm having trouble with my regex. I'm sure something is not escaping properly. function regex(str) { str = str.replace(/(~|`|!|@|#|$|%|^|&|*|\(|\)|{|}|\[|\]|;|:|\"|'|<|,|\.|>|\?|\...
Daniel Williams's user avatar
0 votes
2 answers
779 views

I am wondering if it is possible to create a regular expression which will allow digits, letters and spaces but no punctuation. Whats happening is I have an online loan application and in the street ...
Kbam7's user avatar
  • 344
0 votes
2 answers
65 views

I'm making some code that scans an item for its price, and the price is located inside a class "cash". The text inside the cash class looks like this 1,000 I ...
J Doe's user avatar
  • 39
0 votes
0 answers
30 views

How to find non letters from expression ? example string " friday is piątek, but in different language!" i did that but without efford : elem1 = element.replace(/\s/g, ''); elem2 = elem1.replace(/\-/...
Piotr Mirosz's user avatar
875 votes
41 answers
800k views

How can I count the number of times a particular string occurs in another string. For example, this is what I am trying to do in Javascript: var temp = "This is a string."; alert(temp.count("is")); //...
TruMan1's user avatar
  • 36.6k
803 votes
27 answers
781k views

Given a string like: "The dog has a long tail, and it is RED!" What kind of jQuery or JavaScript magic can be used to keep spaces to only one space max? Goal: "The dog has a long tail,...
AnApprentice's user avatar
15 votes
8 answers
15k views

I am trying to break the following sentence in words and wrap them in span. <p class="german_p big">Das ist ein schönes Armband</p> I followed this: How to get a word under cursor using ...
Rakesh Juyal's user avatar
6 votes
8 answers
53k views

So, you can easily check if a string contains a particular substring using the .includes() method. I'm interested in finding if a string contains a word. For example, if I apply a search for "on" ...
Khadar111's user avatar
  • 171
4 votes
7 answers
5k views

I want to remove space before every punctuation in Javascript/jquery. For example Input string = " This 's a test string ." Output = "This's a test string."
Venkat's user avatar
  • 115
1 vote
2 answers
9k views

I need to remove fractional addresses from a street address input line. I need to allow for people who enter strings like the following: 1600 1/2 Main St 1600 3/4 Main Street 1600.5 Main St 1600.75 ...
paulmiller3000's user avatar
0 votes
6 answers
3k views

The users on my review type of platform highlight titles (of movies, books etc) in <em class="title"> tags. So for example, it could be: <em class="title">Pacific Rim&...
Henrik Petterson's user avatar
0 votes
2 answers
3k views

How to detect number, uppercase, lowercase data in string using JavaScript ? Why does this code tell me $, # and ! are upper/lower case ? How can I detect only number, uppercase, lowercase ? https:/...
mongmong seesee's user avatar
0 votes
2 answers
1k views

i have two sentences and i would like to find all the words they share regardless of capitalization or punctuation. currently this is what I am doing: searchWords = sentence1.split(" "); var ...
Tadewos Bellete's user avatar
0 votes
3 answers
543 views

I am trying to split a string into an array of single words in Javascript. First step was quite easy: words = text.split(/\b\s+(?!$)/); This solution works fine, except it doesn't use punctuation ...
user avatar
2 votes
1 answer
529 views

With the answers in Javascript unicode string, chinese character but no punctuation and How can I strip all punctuation from a string in JavaScript using regex? I have gotten close to what I need: ...
Qiulang's user avatar
  • 12.9k

15 30 50 per page