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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:54:41+00:00 2026-05-27T20:54:41+00:00

I would like to split the strings like 2x3y5z , 4y , 5x6y ,

  • 0

I would like to split the strings like 2x3y5z, 4y, 5x6y, 7x4z into separate strings:

 "2x3y5z" = { "2x", "3y", "5z" }
 "7x4z"= { "7x", "4z" }

My current solution involves Substring and Replace and looks quite convoluted. Is it possible to do this in RegEx in a much simpler way ?

  • 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-27T20:54:42+00:00Added an answer on May 27, 2026 at 8:54 pm

    What are the rules to split the string? The following regexp assumes you have number from 0 to 9 and after that character from a to z.

            string pattern = @"[0-9]{1}[a-z]{1}";            
            var regexp = new System.Text.RegularExpressions.Regex(pattern);
    
            var matches = regexp.Matches("2x3y5z");            
    
            foreach (var match in matches)
            {
                Debug.WriteLine(match);
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a regular expression that would split strings like itemXY where X and
I would like some guidance on how to split a string into N number
I am writing many files to disk, and I would like to split them
I have a large source repository split across multiple projects. I would like to
I would like to be able to filter a listbox containing 1000 strings, each
I would like to sort an array of strings (in JavaScript) such that groups
I have a large array in PHP. It contains strings that are split into
I'm having trouble figuring out how to split a string into groups of like
PHP's explode function returns an array of strings split on some provided substring. It
I am trying to split strings into lists of tags in python. The splitting

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.