mIRC Homepage
Posted By: Wims Retrieving named captures with $regml() - 30/11/16 06:10 PM
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.
Posted By: Wims Re: Retrieving named captures with $regml() - 13/06/17 08:36 PM
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.
Posted By: Protopia Re: Retrieving named captures with $regml() - 30/06/17 09:28 PM
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.
Posted By: Wims Re: Retrieving named captures with $regml() - 30/06/17 09:31 PM
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.
Posted By: digitok Re: Retrieving named captures with $regml() - 15/12/17 03:26 AM
I also support this idea.
© mIRC Discussion Forums