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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:00:52+00:00 2026-06-13T23:00:52+00:00

I want to distinquish strings like `citizen_group` int(10) NOT NULL, `container_group` int(10) NOT NULL,

  • 0

I want to distinquish strings like

`citizen_group` int(10) NOT NULL,
`container_group` int(10) NOT NULL,

from strings like

PRIMARY KEY (`citizen_group`,`container_group`),
KEY `fk_containergroup_readeraccess` (`container_group`)

Therefor I’ve created this regex

`?\w+`?\s\w+\(d+(,\s?\d+)?\)
   ^

*\w+`*   : string, wrapped in ` is possible.                `column`
\s       : followed by a space                       
\w+      : followed by one or more characters                real
\(d+     : followd by ( with one or more digits              (10
(,\s?\d)?: followed by 0 or 1 , with digits                  ,3
\)       : end with a )                                      )

But this regex selects not only to first 2 strings, but also the last

KEY `fk_containergroup_readeraccess` (`container_group`)

Can someone tell me why this is? And how I need to modify the regex so that it selects only the first two?

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

    I tested with this program:

    import re, sys
    for line in sys.stdin:
        match = re.search(r'`?\w+`?\s\w+\(\d+(,\s?\d+)?\)', line)
        if match:
            print match.group(0)
    

    (Note that you’re missing the ‘\’ in ‘\d’ immediately following the open parenthesis; I fixed that in this test.)

    It matches your first two examples and does not match your second two examples, so I believe it’s working as you intended it.

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

Sidebar

Related Questions

want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's
Want to run javascript function from parent window in child window Example I have
Want to open firefox from terminal at linux with firebug enabled // Terminal $
want to know why String behaves like value type while using ==. String s1
Want to code a key pad for an calculator. What I want to make
want to ask user to input something but not want to wait forever. There
What I want to do may seem like a weird scenario. Please keep in
I want to distinguish access from Cordova/PhoneGap or others in a web server. I
I like Scala's sys.error function - but I want to distinguish two cases: internal
I recently created an interface layer to distinguish the DataAccessProvider from our Business logic

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.