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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:34:58+00:00 2026-06-10T16:34:58+00:00

Referring to http://docs.python.org/howto/regex.html section Non-capturing and named groups , I saw an example whose

  • 0

Referring to http://docs.python.org/howto/regex.html section Non-capturing and named groups, I saw an example whose output is not obvious to me.

  >>> import re

  >>> m = re.match(r"([abc])+", "abc")
  >>> m.groups()

 ('c',)

Here I am not able to understand why the group(1) is ‘c’ and also why I see I dangling comma at the end. Can somebody help?

  • 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-10T16:34:59+00:00Added an answer on June 10, 2026 at 4:34 pm

    I don’t know about the dangling comma, but your first group is c, because you let the group repeat itself by putting the + after the group, and not after the character group.

    This way, the regex first matches a, which is assigned to group 1. Then, it matches b, which is also assigned to group 1. And at last, it matches c, assigned to group 1 and finishes; thus leaving your group 1 to be c.

    If you write ([abc]+), your group 1 will be abc.

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

Sidebar

Related Questions

I am referring to http://www.postgresql.org/docs/8.1/static/libpq.html I try to find an example of C/C++ to
I'm referring to this: http://docs.python.org/tutorial/datastructures.html What would be the running time of list.index(x) function
I don't understand the following part of the Python docs: http://docs.python.org/reference/expressions.html#slicings Is this referring
Here is example code I am referring to: http://xml.apache.org/xalan-j/usagepatterns.html#sax First, notice that everything that
I am referring to the test harness listed here http://docs.oracle.com/javase/tutorial/essential/regex/test_harness.html The only change I
By refering code at http://initd.org/psycopg/docs/extras.html#dictionary-like-cursor >>> rec['data'] abc'def >>> rec[2] abc'def I was wondering
From http://java.sun.com/docs/books/performance/1st_edition/html/JPAppGC.fm.html#99740 example A3.3 says, it says that an object might still not be
I am referring to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/AlarmService_Service.html There the runnable of the thread looks like this
Going to http://www.example.com/node/NID/edit , where NID is any valid nid referring to a node
I'm referring tothe datastore admin tool explained here: http://code.google.com/appengine/docs/adminconsole/datastoreadmin.html One way of backing up

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.