Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 856889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:18:37+00:00 2026-05-15T08:18:37+00:00

I need to convert strings pasted into a text area so that, if they

  • 0

I need to convert strings pasted into a text area so that, if they were pasted from MS Word, the weird quotation marks and apostrophes that Word likes to use will get converted to regular single and double quotes. Unfortunately my text editor seems to already convert such quotes when I save, so any regular expression I make seems to get messed up. So something like this

string = string.replace(new RegExp("“", "g"), '"').replace(new RegExp("”", "g"), '"').replace(new RegExp("’", "g"), "'");

doesn’t seem to work. (and I don’t even know if it will post correctly here)

How do I construct the regular expression to find these quotation marks using all “regular” characters? Presumably an escape sequence? I prefer avoid the RegExp “literal” notation, even if creating objects is slower.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:18:38+00:00Added an answer on May 15, 2026 at 8:18 am

    Try getting the ASCII code of the characters you want removed and use it instead of the character itself:

    string = string.replace(new RegExp("\xe2\x80\x9c", "g"), '"').replace(new RegExp("\xe2\x80\x9d", "g"), '"').replace(new RegExp("\xe2\x80\x99", "g"), "'");
    

    (I used Notepad++ with the HexEdit plugin to get the code)

    Edit:
    See at http://www.regular-expressions.info/unicode.html for more details.
    Your code should be (hope I didn’t mix the codes…):

    string = string.replace(new RegExp("\u201c", "g"), '"').replace(new RegExp("\u201d", "g"), '"').replace(new RegExp("\u2019", "g"), "'");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to convert strings with optional trailing signs into actual numbers using Powershell.
I need to convert several million dates stored as wide strings into boost dates
I have an xml document object that I need to convert into a string.
I need to convert incoming phone number strings to a standardized format that does
I need to convert strings in Python to other types such as unsigned and
I need to convert unicode strings in Python to other types such as unsigned
Let's say I have an integer that I need to convert to a string
I need to convert from a SQLVARCHAR to a string data type Variable definitions
I have a string that I need to convert to the equivalent array of
My .NET library has to marshal strings to a C library that expects text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.