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 3698628
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:00:16+00:00 2026-05-19T05:00:16+00:00

I am having a few problems with regex in C#. I require a string

  • 0

I am having a few problems with regex in C#. I require a string to be passed in and only the letters to be returned (as a string), so for example if the string is “4hr”, I want “hr” to be returned. If the string is “Gp. 23”, I just want “Gp” to be returned.

I’ve tried:

 string[] extractedWords = System.Text.RegularExpressions.Regex.Split(expr, "[a-zA-Z]");

But that doesn’t seem to work.

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

    If you want just a string to be returned, using split is a bad idea. How about:

    string filtered = Regex.Replace(expr, "[^A-Za-z]", "");
    

    In other words “replace anything that isn’t A-Z or a-z with an empty string”. Note that that will also strip non-ASCII letters; you may want to use a Unicode character class (e.g. “letter”) instead.

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

Sidebar

Related Questions

Having a few problems with Timers within a service on Win2k3... Basically, creating a
I'm having a few problems converting video files from the command line using FFMPEG.
Having a few problems with output buffering. Mainly, I'm trying to run output buffering
I'm having a few problems trying to position some div s in my website
I am having a few problems loading a table into the designer. I get
Im having a few problems with the form_dropdown function in CodeIgniter .... My application
hey stackoverflowers. im having a few problems with the code i have written to
So I have built a booking system, and I am having a few problems
I am having a few issues when people are trying to access a MySQL
I'm a rookie designer having a few troubles with this page: http://www.resolvegroup.co.nz/javasurvey.php There are

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.