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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:36:56+00:00 2026-06-05T19:36:56+00:00

I have been given some poorly formatted data and need to pull numbers out

  • 0

I have been given some poorly formatted data and need to pull numbers out of strings. I’m not sure what the best way to do this is. The numbers can be any length.

string a = "557222]]>";
string b = "5100870<br>";

any idea what I can do so I’ll get this:

a = "557222"
b = "5100870"

Thanks

Solution is for c# sorry. Edited the question to have that tag

  • 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-06-05T19:36:59+00:00Added an answer on June 5, 2026 at 7:36 pm

    Not familiar enough with .NET for exact code. Nonetheless, two approaches would be:

    • Cast it as an integer. If the non-digit characters are at the end (i.e. 21389abc), this is the easiest.
    • If you have intermixed non-digit characters (i.e. 1231a23v) and want to keep every digit, use the regex [^\d] to replace non-digit characters.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given a task of inputting some student data, like option 1:
I have been given some 'reports' from another piece of software that contains data
I've been given some strings to work with. Each one represents a data set
I have been given some basic documentation of the RazorGator REST API and need
I have been given some matlab code compiled using the .net compiler. I can
I have been given some generated code which looks like so: <form id=form1 method=post
I have been given the task of re-writing some libraries written in C# so
I have been given some file name which can be like <filename>YYYYMMDD<fileextension> some valid
I have been given the tasks of speccing a mobile application, which will need
I am very new to Spring and I have been given some basic instructions

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.