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
3 votes
2 answers
391 views

I'm using the following line of PHP to remove punctuation from strings: $key = preg_replace("/\p{P}/u", "", $key); Does anyone know how to do the same thing in Javascript/jQuery? I know you can use ...
liz's user avatar
  • 830
1 vote
2 answers
91 views

Following this question How can I strip all punctuation from a string in JavaScript using regex? I'm trying to remove all punctuation from a string besides the ' character to avoid messing with words ...
Bruno Francisco's user avatar
0 votes
3 answers
117 views

I am trying to solve a palindrome problem. The palindrome can contain letters and numbers, but everything else must be removed. My code below is not returning the correct result. function palindrome(...
Scott Wells's user avatar
0 votes
1 answer
140 views

I've been trying to redo a message filter for a little while now, and I'm stumped on something with it. I have a list of different words in different categories that the filter blocks, but there's ...
Nick's user avatar
  • 105
1 vote
1 answer
149 views

I want to be clear I'm not looking for solutions. I'm really trying to understand what is being done. With that said all pointers and recommendations are welcomed. I am woking through freecodecamp.com ...
David Stuard's user avatar
1 vote
1 answer
77 views

Say I have var string1 = "Hello" and string2 = "Hello" How can I compare these two and ignore the capitals and the punctuation in javascript?
Matthew Parks Jr's user avatar
0 votes
1 answer
86 views

I'm looking for a way to remove these characters from a string in javascript (and spaces). ?[]/\=<>:;,'\"&$#*()|~`!{} I am unsure how to construct this: "mystring is - ?[] hello ".replace(...
bradley's user avatar
  • 776
-1 votes
2 answers
48 views

I got a question in vb.net can I identify each of the character in string for an example i got a string of "Hello!. Good Afternoon!" from this string can i trim away the period symbol? Thank you
Arnold Nold's user avatar
0 votes
1 answer
21 views

So here is my current js fiddle http://jsfiddle.net/sbyLb93n/6/ I have tried adding .replace(/\W*/mg, "") to wordsArr and valuesArr before I turn the string of text into an array of strings ...
pbordeaux's user avatar
  • 465