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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:36:08+00:00 2026-06-15T23:36:08+00:00

I’m trying to split a string by group defined through a regex using the

  • 0

I’m trying to split a string by group defined through a regex using the Object Match like this :

if(match.Success)
{
    foreach (Group group in match.Groups)
    {
        foreach(Capture capture in group.Captures)
        {
            //...
        }
    }
}

The strings I’m supposed to match are formed like this : Begin or no with “, any caracter any number of time (including “, \r, \n etc.), If begin with ” end with ” too, followed by ; then any caracter any number of time, another;, to finish at least once a mix of space and numbers.

Im using this regexp :

("?[.|\n|\r|\r\n]*"?);(.*);([\d| ]*)(;([\d| ]*))*

I’d like to have the first group which is a string with any char,the second group : string which is only text/number, the third group is always here and is a mix of spaces and numbers and if there are more groups of spaces and number, get them in the group 4,5 6 etc.

An exemple of string i have to match :

“VIS METAUX TETE CYLINDRIQUE FENDUE EN ACIER ZINGUE DIAMETRE
M10”;Longueur 60mm;0046 10 30

“Vis à métaux à tête cylindrique fendue. Norme:
DIN 84”;Diamètre 3 mm. Longueur 16 mm;0046 3 16

“Tournevis Torx sur monture : 10, 15, 20, 25, 30, 40”;;0613 434
10;0613 434 10;0613 434 20

This doesn’t work at all, the group I match are rarely good and I don’t get how i can do that.

  • 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-15T23:36:09+00:00Added an answer on June 15, 2026 at 11:36 pm

    This will only work if you can get each “line” as a separate string, but rather than trying to split, I’d use a regular expression to match each field:

    // Unescaped regular expression is (?<=")[^"]*(?=")|(?<=^|;)[^;]*(?=$|;)
    Regex r = new Regex(@"(?<="")[^""]*(?="")|(?<=^|;)[^;]*(?=$|;)");
    foreach (Match field in r.Matches(csvLine))
       ... // do something with field.Value
    

    The regular expression matches “a load of non-quote characters with a quote before and after it OR a load of non-semicolon characters with a semicolon or start/end of string before and after it)

    • 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: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.