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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:46:17+00:00 2026-05-16T17:46:17+00:00

This is my second attempt to get this answer since I messed it up

  • 0

This is my second attempt to get this answer since I messed it up first time :s As you can guess Im new to regex

basically, the string contains lots of words seperated by “\”‘s. so for example

\gyifgy8i\gyigyi9g\player_0\k1ng*tar%\gp86gg78.\g79g\player_1\th3dadY>\gyigyigiy\huiohgiu\player_2\j0k$r\g68g6o9g\987pgh890\player_3\PLAYERNAME

I need a patter which can match each word after \player_n\ , where n is a number. so from the above i want to match k1ng*tar% and th3dadY> and j0k$r (without the \ either side). these are player names from a UDP query, the udp query sperates every value with “\”. every player name is always preceeded by \player_n\ as you can see above.

originally i was advised to used:

string rex = @"[\w]*[\\]player_[0-9]+[\\](?<name>[A-Za-z0-9]*)\b";
        Regex re = new Regex(rex);


            for (Match m = re.Match(stringData); m.Success; m = m.NextMatch())
        {

            players[count] = (m.Groups["name"]).ToString();
            textBox1.Text += players[count] + "\r\n";
            MessageBox.Show((m.Groups["name"]).ToString());
        }

The above pattern kinda works, but only if the playername is using A-Za-z0-9. I didnt realise at the time that playername can contain any character. can someone modify this pattern for me please, regex is beyond me :<

Thanks in advance.

  • 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-16T17:46:18+00:00Added an answer on May 16, 2026 at 5:46 pm

    Provided the rest of the regex works as desired, you could replace

    (?<name>[A-Za-z0-9]*)
    

    with

    (?<name>[^\\]*)
    

    which will match everything except \

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

Sidebar

Related Questions

How can I make this second struct work, when the first struct has a
If this is the first string : ABCD if this is the second string:
This is my lame first attempt. I would like to get a count of
(Hope this doesn't get duplicated; second attempt at submitting this question) I'm working on
This is my second attempt at this question . I made a mess of
This is my second question on Bamboo ( My First One ). My understanding
I have the following paragraphs: <p>This is a first paragraph.</p> <p>This is a second</p>
Second attempt at this question (the initial code wasn't enough to highlight the issue)
I am trying to check if the second attempt(u can imagine anything like password
I've tried everything to figure this out but I can't get the correct total.

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.