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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:41:06+00:00 2026-06-05T16:41:06+00:00

I know that capture-parenthesed subexpressions is counted in back reference numbering even when they’re

  • 0

I know that capture-parenthesed subexpressions is counted in back reference numbering even when they’re in an optional part that don’t match, but what about when they’re in a branch of an alternation? Will (adam)|(eve) give adam in \1 or eve in \2, or adam or eve in \1?

Are all capturing-parenthes still counted from left to right or do these two count as one in the numbering? If so, what happens when you have a different number of captures in the choices, like (god)|(adam)&(eve)?

I want to capture a value with either ”, “” or nothing around it, and this is what i have:

(['"])(.*?)\1|([^'"]+)
  • 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-05T16:41:08+00:00Added an answer on June 5, 2026 at 4:41 pm

    The back-references count the amount of parenthesis, regardless of how many of them have been matched.

    So, in (god)|(adam)&(eve):

    \1 – “god” or empty
    \2 – “adam” or empty
    \3 – “eve” or empty

    See here: http://jsfiddle.net/MnASH/

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

Sidebar

Related Questions

Does anybody know how to capture the message that a sender sends the recipient
for website that embed flash to capture camera (red5..etc). may i know is there
I know that can't use left join in indexed view. but I don't understand
How to capture user selected installation path? I know that I can get the
I know that you can capture the event when a person clicks a like
I know that .NET lambda expressions can capture outer variables. However, I have seen
We all know that hitting the back button on the device doesn't kill the
I know that definitions for :hover must come before the definition for :active in
I know that a bottom-up parser is better than a top-down parser because it
I know that there are some threads have a similar issue with this thread.

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.