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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:05:55+00:00 2026-05-18T09:05:55+00:00

I have one string, that looks like this: a[abcdefghi,2,3,jklmnopqr] The beginning a is fixed

  • 0

I have one string, that looks like this:

a[abcdefghi,2,3,jklmnopqr]

The beginning “a” is fixed and non-changing, however the content within the brackets is and can follow a pattern. It will always be an alphabetical string, possibly followed by numbers separate by commas or more strings and/or numbers.

I’d like to be able to break it into chunks of the string and any numbers that follow it until the “]” or another string is met.

Probably best explained through examples and expected ideal results:

a[abcdefghi]               -> "abcdefghi"
a[abcdefghi,2]             -> "abcdefghi,2"
a[abcdefghi,2,3,jklmnopqr] -> "abcdefghi,2,3" and "jklmnopqr"
a[abcdefghi,2,3,jklmnopqr,stuvwxyz]     -> "abcdefghi,2,3" and "jklmnopqr" and "stuvwxyz"
a[abcdefghi,2,3,jklmnopqr,1,9,stuvwxyz] -> "abcdefghi,2,3" and "jklmnopqr,1,9" and "stuvwxyz"
a[abcdefghi,1,jklmnopqr,2,stuvwxyz,3,4] -> "abcdefghi,1" and "jklmnopqr,2" and "stuvwxyz,3,4"

Ideally a malformed string would be partially caught (but this is a nice extra):

a[2,3,jklmnopqr,1,9,stuvwxyz] -> "jklmnopqr,1,9" and "stuvwxyz"

I’m using Javascript and I realize a regex won’t bring me all the way to the solution I’d like but it could be a big help. The alternative is to do a lot of manually string parsing which I can do but doesn’t seem like the best answer.

Advice, tips appreciated.

UPDATE: Yes I did mean alphametcial (A-Za-z) instead of alphanumeric. Edited to reflect that. Thanks for letting me know.

  • 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-18T09:05:56+00:00Added an answer on May 18, 2026 at 9:05 am

    You’d probably want to do this in 2 steps. First, match against:

    a\[([^[\]]*)\]
    

    and extract group 1. That’ll be the stuff in the square brackets.

    Next, repeatedly match against:

    [a-z]+(,[0-9]+)*
    

    That’ll match things like “abcdefghi,2,3”. After the first match you’ll need to see if the next character is a comma and if so skip over it. (BTW: if you really meant alphanumeric rather than alphabetic like your examples, use [a-z0-9]*[a-z][a-z0-9]* instead of [a-z]+.)

    Alternatively, split the string on commas and reassemble into your word with number groups.

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

Sidebar

Related Questions

I have one method that looks like this: void throwException(string msg) { throw new
I have a String that looks like this: Blah blah one.<tmp>[[url=b, link=c]]</tmp> Blah blah
I have a string that looks like this: [2005] one two three [2004] six
i have one dictionary that has entries that looks like this: dictionary[ABC.123] = Test
I can have a string that looks like this as an example: sometext<a title=Wink><img
Say I have a string that looks like this: str = The &yquick &cbrown
I have some one-many normalized data that looks like this. a | x a
i have a string that looks like this Patient Name, Doc Name, Patient ID,
Lets say I have an enumerable source, that looks like this: IEnumerable<string> source =
I have a string that kind of looks like this: stuff . // :

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.