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

  • Home
  • SEARCH
  • 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 6945943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:30:04+00:00 2026-05-27T13:30:04+00:00

Imagine this: a = (‘a’,’b’,’c’),(‘d’,’e’,’f’) I am trying to split it using re so

  • 0

Imagine this:

a = "('a','b','c'),('d','e','f')"

I am trying to split it using re so that I will get an array of 2 elements, containing "('a','b','c')" and ('d','e','f'). I tried :

matches = re.split("(?:\)),(?:\()",a)

but this gives me the result:

'(2,3,4'
'1,6,7)'

I could parse it, character by character, but if a regex solution is possible, I would prefer it.

  • 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-27T13:30:04+00:00Added an answer on May 27, 2026 at 1:30 pm

    You need to split on the comma which is preceded by a ) and followed by a (. But the parenthesis themselves should not be part of the split point. For that you need to use positive lookahead and positive look behind assertions as:

    matches = re.split("(?<=\)),(?=\()",a)
    

    See it

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

Sidebar

Related Questions

I imagine this makes no difference, but I will try to access it using
Imagine this case where I have an object that I need to check a
For you guys, I imagine this will be easy. <div class=vote_pct style=width: $widthpx;> I
I imagine this is common enough that it's a solved problem, but being a
I imagine this should be a pretty trivial task but using Firefox for Mac,
imagine this: public class Foo { private IList<string> WasSet; public string Prop1 {get;set;} public
Imagine this scenario: you have a WCF web service that gets hit up to
I imagine this is pretty simple, but can't figure it out. I'm trying to
I imagine this is pretty dead-simple, but somehow I haven’t been able to get
I have a content that I'd like to rate on multiple criteria. Imagine this

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.