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

The Archive Base Latest Questions

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

I have a string like this: blah blah blah_0123 So basically i need a

  • 0

I have a string like this:

  • blah blah blah_0123

So basically i need a regular expression to get those 4 numeric values after the _ delimiter. I’m sure it’s super simply but Regex looks like a foreign language to me!

  • 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-27T14:59:33+00:00Added an answer on May 27, 2026 at 2:59 pm

    That would be this regular expression:

    _([0-9]+)
    

    (Capture group 1 holds the number.)


    Or if your engine supports lookbehinds (which as far as I remember is not the case for C#):

    (?<=_)[0-9]+
    

    (Capture group 0 holds the number.)


    The (...) denotes a catch group. In your match object you can then either access them by their index via yourMatch.Groups[index].Value or if you named your catch groups via (?<name>...) by their name like yourMatch.Groups[name].Value. The value will then hold whatever was matched by that particular group’s sub-expression (in your case the 4-digit number).


    Also if you only want the regex to match if those are exactly 4 numeric characters,
    then replace the + with {4}\b

    Edit: As Alan Moore correctly pointed out those are called “capture group”, not “catch group”. I need more sleep.

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

Sidebar

Related Questions

I have a string like this that I need to parse into a 2D
I have a string Like this: MyText (1,151) I would like to get with
I have something like the following in a string: blah blah BEGINIGNORE this stuff
I have a JSON String like this $test='{var1:null,var3:null,status:{code:150,message:blah blah}}'; I want to access the
I have a string that looks like this: blah blah blah yada yada http://www.example.com/check?x=rabP4F3Mk&dept=check
If I have a string like this: $str = blah blah blah (a) (b)
I have string like this: Some standard text CONST_INSIDE_QUOTES blah blah CONST There might
So I have a HTML string like this: <td class=name> <a href=/blah/somename23123>Some Name</a> </td>
Ok, so I have a string like so: index.php?page=test2;sa=blah And I need only to
I have a string that looks like this: blah blah blah Team ID:</div>xxxxxxx blah

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.