logos
logos copied to clipboard
Regex not returning $1
I'm expecting the regular expression string to return the values inside the parentheses () similar to perl 's $1 so for a string of:
my_label:
I expect
#[regex("([[:word:]]+):",lcaseit, ignore(ascii_case) )]
LABEL(String),
to return
my_label
without the : at the end. But it returns the entire string.
It seems it does not have capturing groups for now: https://github.com/maciejhirsz/logos/issues/214#issuecomment-875521408 , nor lookahead, lookbehind, nor their negative counterparts.
I would like to add a +1 to the request for supporting capture groups. It would be much more ergonomic (and probably faster) to return a capture directly from the regex than to pass the entire slice to a callback function and parse it all over again just to extract the relevant data.