Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
3 answers
188 views

How do I split a sentence into words and punctuation?

I want to replace any word that follows a certain condition in a text, with another word, which varies, depending on the first word. The possibilities of the other word is stored in an array, and the ...
ih8bugs's user avatar
  • 23
0 votes
2 answers
88 views

Autocapitalize each sentence beginning after a period

I'm trying to make it so that when a user is entering text in an input field, their sentences will autocapitalize. Some people are already bad enough with proper grammar and punctualization, so this ...
Brandon Blessing's user avatar
2 votes
1 answer
2k views

Regular expression to allow punctuation marks and spaces between words

I want a regular expression that prevents white spaces and only allows letters and numbers with punctuation marks(Spanish). The regex below works great, but it doesn't allow punctuation marks. ^[a-zA-...
Jose Aguirre's user avatar
3 votes
1 answer
215 views

Javascript Punctuation in an array is returning 'undefined'

I am trying to write a small cipher program and need to assemble words along with punctuation. The code works perfectly if I use letters/numbers/special characters ! through ) but isn't working with a ...
SteampunkWizard's user avatar
0 votes
0 answers
15 views

How to use quotation marks inside a JavaScript array [duplicate]

I have a short story which I've split up so each line of the story is a new element in a JavaScript array. However, some lines of the story use quotation marks as punctuation so they can't be used as ...
wrgt's user avatar
  • 177
1 vote
2 answers
444 views

JavaScript regular expression to match a word with any kind of punctuation at the end

I am trying to translate sentences into Pig-Latin using regular expressions. I need to select the words with any kind of punctuation at the end so that I can handle those cases differently. For ...
Martha Sharpe's user avatar
2 votes
1 answer
1k views

HTML: Prevent line breaks before some punctuation characters preceeded by a whitespace

In French typography conventions, few punctuation characters like ;,: or ? must be preceeded by a white space. This is causing unwanted line breaks when the punction is at the border of its HTML ...
Ludovic's user avatar
  • 283
1 vote
1 answer
492 views

How to wrap letters inside span including punctuation and special characters?

I'm using a jquery text animation based on this demo. I first have to wrap all my letters inside span. it works fine using this code, but my punctuation (".", ",", "-")... and special characters (@) ...
mmdwc's user avatar
  • 1,137
0 votes
1 answer
24 views

how to not include punctuation after url

So I have this code, const urlPattern1 = new RegExp( "(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}[^.,!?:;\\s]+$/?|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\...
Oliver S's user avatar
-4 votes
2 answers
119 views

Why doesn't this work in JavaScript: line === '}'

I'm sure this is a very basic question, but I've look quite a bit for the answer and I can't find it. All I want to do is to see if an element in an array matches } (i.e., a right brace). But this ...
globewalldesk's user avatar
0 votes
1 answer
172 views

HTML/JS end of line punctuation wrongly aligns to the left

I encountered a strange display of punctuation within DIV elements. In my HTML the text is something like: This is just some random text...!! But in the browser window, it systematically becomes: ...
sc28's user avatar
  • 1,213
0 votes
1 answer
85 views

How to replace one punctuation with and or & randomly using javascript

am trying to remove the punctuations which are followed by punctuations and I have done it but I need to replace the last but second punctuation mark in sentence with and or & randomly. Here is ...
shanseti vikas's user avatar
2 votes
2 answers
152 views

Javascript regexp with unicode and punctuation

I have the follow test case for splitting unicoded words but don't know how to do in it javascript. describe("garden: utils", () => { it("should split correctly", () => { assert.deepEqual(...
Hung Phan's user avatar
0 votes
3 answers
9k views

Other ways to remove or ignore punctuation in JS besides regex?

I'm working through some beginner Coderbyte problems and I've come across an interesting dilemma. Here's the problem: "Using the JavaScript language, have the function LongestWord(sen) take the sen ...
jakewies's user avatar
  • 462
1 vote
1 answer
4k views

check if a string only has punctuation in it in javascript

In an if statement, I want to check if the string has punctuation in it. If it has punctuation, I want an alert message to pop up. if((/*regex presumably*/.test(rspace))==true||(/*regex presumably*/....
Stephen Gevanni's user avatar

15 30 50 per page