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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:44:09+00:00 2026-05-26T07:44:09+00:00

Given a regular expression with named captures, is it possible to determine which named

  • 0

Given a regular expression with named captures, is it possible to determine which named captures are present in the re?

Note: I only have the regular expression – I don’t have a string which matches the re. I want to know if there is a way to look into the structure of the re and find all of the named captures used in the re.

  • 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-26T07:44:09+00:00Added an answer on May 26, 2026 at 7:44 am

    That’s not possible in the general case, because someone could have a (??{....}) code insert that turns into something that uses a named capture of a hitherto unseen name during match execution time.

    In a specific case you might be able to dig into the underlying structure from the C API. Devel::Peek suggests some places you might want to poke around:

    % perl -MDevel::Peek -le 'Dump qr/(?<foo>\w+) (?&foo)/'
    SV = IV(0x8033ac) at 0x8033b0
      REFCNT = 1
      FLAGS = (TEMP,ROK)
      RV = 0x803d40
      SV = REGEXP(0x8173d8) at 0x803d40
        REFCNT = 1
        FLAGS = (OBJECT,POK,FAKE,pPOK)
        PV = 0x216fc0 "(?^:(?<foo>\\w+) (?&foo))"
        CUR = 24
        LEN = 0
        STASH = 0x803b50    "Regexp"
        EXTFLAGS = 0x600000 (USE_INTUIT_NOML,USE_INTUIT_ML)
        INTFLAGS = 0x1
        NPARENS = 1
        LASTPAREN = 0
        LASTCLOSEPAREN = 0
        MINLEN = 3
        MINLENRET = 3
        GOFS = 0
        PRE_PREFIX = 4
        SEEN_EVALS = 0
        SUBLEN = 0
        SUBBEG = 0x0
        ENGINE = 0x162b60
        MOTHER_RE = 0x80fab0
        PAREN_NAMES = 0x80fa40
        SUBSTRS = 0x2044b0
        PPRIVATE = 0x206360
        OFFS = 0x204280
    

    For example, PAREN_NAMES looks promising.

    But that seems like a lot of work. What do you want to do this for?

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

Sidebar

Related Questions

Given a regular expression, I'm looking for a package which will dynamically generate the
What regular expression can I use (if any) to validate that a given string
I have the following regular expression which is used to give me the tags
I have written following regular expression /^[A-Za-z0-9-_\s]*$/ in PHP which allows numbers, letters, spaces,
I'm trying to write a regular expression that will check so a given string
Given a html document, what is the most correct and concise regular expression pattern
Hi guys I am looking for a regular expression which will not match any
Is it possible to use named arguments in Java or Javascript with regular expressions
I have this regular expression that extracts meta tags from HTML documents but it
A while back I came across a ruby gem that, given a regular expression,

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.