haskell - Regex capturing named groups in a language that doesn't support them using a meta regex? -
I am using Haskell and I think that I have a group of nominated groups to support it Can not find a REGEX package that supports itself Basically a group of names of my APIs use some regeses to get back to the groups captured in a Mac.
/ (? P & lt; name & gt; [az] *) / hhhh / (? P <(name "," foo "); > *) / jjj at / foo / hhhh / bar / jjj
I have a specification with relatively small wires Now the performance is not the main issue. Therefore, to solve this, I thought I would write the Meta Regex which is the user
/ (? P & lt; name & gt; [az] *) / hhhh / (? P 0 -> group names to get Surname & gt; [az] *) / jjj
name 1 -> nickname
to remove and replace them Regex
/ ([az] *) / hhhh / ([az] *) / jjj
>Two questions:
- Does this sound like a good idea?
- For those unfamiliar with named groups
Note: Named groups syntax is required to capture and replace: All what name group do I need that the users keep the names of matches Therefore, a group of designated groups Well I only me.
The more you want to implement your solution, the more complex your problem becomes. For example, in your view, you want to remove the named groups and use the index (index?) To match. It sounds like a good start, but you've considered a few things:
- If you change
(? & Lt; name & gt; blah)
With(blah)
then you have to replace the name with / 1 or / or 2.- What if the user also includes non-named groups? For example:
([az] {3}) / (? P & lt; name & gt; [az] *) / hhhh / (? P & lt; surname & gt; [az] *) / Jjj / foo / hhhh / bar / jjj
. In this case, your number will not work in B / C Group 1, is a non-denominated group defined by the user.Check out this post for some postings, as it seems that others successfully made the same effort (though in Java)
Comments
Post a Comment