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

  • SEARCH
  • Home
  • 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 7070299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:32:59+00:00 2026-05-28T05:32:59+00:00

I need a string with non alpha-numeric characters etc stripped out of it; I

  • 0

I need a string with non alpha-numeric characters etc stripped out of it; I used the following:

wordsstr = Regex.Replace(wordsstr, "[^A-Za-z0-9,-_]", "");

The problem being dots (.)s are left in the string yet they are not specified to be kept. How could I make sure dots are gotten rid of too?

Many thanks.

  • 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-28T05:33:00+00:00Added an answer on May 28, 2026 at 5:33 am

    You are specifying that they need to be kept – you’re using ,-_ which is everything from U+002C to U+005F, including U+002E (period).

    If you meant the ,-_ to just mean comma, dash and underscore you’ll need to escape the dash, such as:

    wordsstr = Regex.Replace(input, @"[^A-Za-z0-9,\-_]", "");
    

    Alternatively, (as in Oded’s comment) put the dash as the first or last character in the set, to prevent it being interpreted as a range specifier:

    wordsstr = Regex.Replace(input, "[^A-Za-z0-9,_-]", "");
    

    If that’s not the aim, please be more specific: “non alpha-numeric characters etc” isn’t really enough information to go on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to filter alphabetic and non alphanumeric characters from a string to make
I need to perform a number of replacements on a string: remove non-alphanumeric characters,
I need to create a Python string consisting of non-ascii bytes to be used
I need to send a very specific (non-standard) string to an FTP server: dir
I need to sort string, and I came up with the following function. def
In my code I need to compare string letters but my problem is that
I need to generate unique non-sequential alphanumeric string of exactly length 6 (not less,
I need to escape % characters in a string entered by the user -
I need to add some non printable chars to a string in java so
Is there an easy way to remove all non alphanumeric characters from a string

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.