Giter Site home page Giter Site logo

Capturing Groups about regexr HOT 12 CLOSED

gskinner avatar gskinner commented on July 19, 2024
Capturing Groups

from regexr.

Comments (12)

gskinner avatar gskinner commented on July 19, 2024

Definitely on our list. It's a difficult feature to implement accurately, because JS RegExp does not return any of this information, so we need to tease it out using trickery. Leaving this open for now.

from regexr.

steven-prybylynskyi avatar steven-prybylynskyi commented on July 19, 2024

probably the regexp input string have to be split, parsed and run separately for each captured group
oh well, it's much more complicated than i think

from regexr.

gskinner avatar gskinner commented on July 19, 2024

It's not that simple. For example:

.*(a)

will match differently than

.*?(a)

will match differently than

.*?

Regular expression tokens are not discrete. They can only be resolved in the context of the full pattern.

On Mar 28, 2014, at 10:14 , stevenp [email protected] wrote:

probably the regexp input string have to be split, parsed and run separately for each captured group

β€”
Reply to this email directly or view it on GitHub.

from regexr.

gskinner avatar gskinner commented on July 19, 2024

Just to add to this - the HiFi tester is completely inaccurate in terms of showing capture groups. They are simply finding the first instance of the group within the match, which obviously isn't correct.

You can test the above example:
.*(a)
in their tester, and see that it highlights the first "a" in the match, when it should highlight the last one.

I'd rather not have this info at all, than have it be incorrect.

from regexr.

steven-prybylynskyi avatar steven-prybylynskyi commented on July 19, 2024

Yep, i've got often incorrect results that was differ from browser's JS RegExp, hence all the hopes on regexr ;)

from regexr.

gskinner avatar gskinner commented on July 19, 2024

As a quick update on this one, I am currently working on an enhanced tools panel, which could include the table view, or something similar. We're probably not going to get group highlighting in any time soon (it's a huge can of worms to get right, and we'll only put it in if it provides accurate results).

from regexr.

steven-prybylynskyi avatar steven-prybylynskyi commented on July 19, 2024

Great news, Grant

from regexr.

bradisbell avatar bradisbell commented on July 19, 2024

Even if you can't associate the captured data with the capture group, it would be helpful just to output the raw result anyway... the equivalent of console.log() on the match.

from regexr.

gskinner avatar gskinner commented on July 19, 2024

I'm actually working on a Details tool at this very moment that will show the full text of a selected match and each group. Does it sound like that will do what you need?

from regexr.

bradisbell avatar bradisbell commented on July 19, 2024

Yes, exactly!
On Dec 14, 2015 11:28 AM, "Grant Skinner" [email protected] wrote:

I'm actually working on a Details tool at this very moment that will show
the full text of a selected match and each group. Does it sound like that
will do what you need?

β€”
Reply to this email directly or view it on GitHub
#6 (comment).

from regexr.

gskinner avatar gskinner commented on July 19, 2024

Details shipped in v2.1, so I'm closing this rather belatedly. As a quick note, the Details tool in v3.0 is more robust, especially when using the PCRE engine (which provides position info for groups).

from regexr.

eromoe avatar eromoe commented on July 19, 2024

But groups color still not show now , only way to see group is using Detail tools?

from regexr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.