ariels has asked for the wisdom of the Perl Monks concerning the following question:
Emacs Lisp provides routines match-beginning, match-end and match-data to access this sort of information.
Currently I do something like this:
and then use length $1 and length $2 to give me the information I need. This is not a good way to do things; among other things, it shifts the numbers of any groupings in $regexp by 2 (this code is not responsible for $regexp).$string =~ /^(.*?)($regexp)/;
And while I get information about the start and extent of the entire match, I don't get any information about the groups!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting information about regexp matches
by converter (Priest) on Apr 23, 2001 at 12:21 UTC | |
|
Re: Getting information about regexp matches
by alfie (Pilgrim) on Apr 23, 2001 at 12:47 UTC | |
by snowcrash (Friar) on Apr 23, 2001 at 14:56 UTC | |
|
Re: Getting information about regexp matches
by arturo (Vicar) on Apr 23, 2001 at 17:43 UTC | |
|
Re: Getting information about regexp matches
by lemming (Priest) on Apr 23, 2001 at 11:59 UTC | |
by ariels (Curate) on Apr 23, 2001 at 12:12 UTC |