mIRC Home    About    Download    Register    News    Help

Print Thread
Retrieving named captures with $regml() #259456 30/11/16 06:10 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
Not sure why there is no support for this but PCRE allows for named capturing group which can be retrieved easily with the lib, I would like to see support for this.

Code:
//noop $regex(myreg,let's capture,/(?<named>capture)/) | echo -a > $regml(myreg,named)
Quote:
> capture


Named captures in PCRE cannot start with a digit.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Retrieving named captures with $regml() [Re: Wims] #260771 13/06/17 08:36 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
It would also be nice to be able to reference the named capture directly in $regsubex's substitution parameter:
Code:
//echo -a $regsubex(myreg,let's capture,/(?<named>capture)/,\k<capture>)
Quote:
let's capture

\k<name> being already supported by PCRE to create a named capture group.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Retrieving named captures with $regml() [Re: Wims] #260891 30/06/17 09:28 PM
Joined: Aug 2003
Posts: 284
P
Protopia Offline
Fjord artisan
Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 284
I tried this yesterday hoping it would work, but apparently not. In the end I had to resort to a cludge using a hash table with regex as items and name mappings as data.

Re: Retrieving named captures with $regml() [Re: Protopia] #260892 30/06/17 09:31 PM
Joined: Jul 2006
Posts: 3,729
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,729
You may want to ask on this forum or on #regex on freenode, there may be a way to do what you want in a different way. But having this would be handy.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Retrieving named captures with $regml() [Re: Wims] #261928 15/12/17 03:26 AM
Joined: Jun 2008
Posts: 6
D
digitok Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2008
Posts: 6
I also support this idea.