R
robertospara
Hi.
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.
My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :
my_regex == son((mother)?father*)+daughter
| | |
13 20 22
So positions 13, 20, 22 I receive from debugger. Then I should write
parser of my regex to get positions :
- beginning of sub-regex "(mother)?"
- beginning of sub-regex "father*"
- beginning of sub-regex "((mother)?father*)+".
I don't see for now any other way. Any clues nice welcome. Best regards.
I am involved in work under project that will visualize the process of
matching the regex to input text.
As data to highlight sub-regexes which take a part in each step of
matching I want to use perl debugger output from regex compilation (
perl -e '-re debug; $text =~/regex/'). In the doc file perldebguts is
very less information about subregexes position in regex that are
already use in matching process. If someone every wanted to do that
could have said the same. My question: Eny ideas to get out from
debugger output elements that I could highlight in each step to
visualize matching process.
My last idea was that I could take from offsets (look in perldebguts if
don't know what I mean) the position where sub-regex is ending for
example :
my_regex == son((mother)?father*)+daughter
| | |
13 20 22
So positions 13, 20, 22 I receive from debugger. Then I should write
parser of my regex to get positions :
- beginning of sub-regex "(mother)?"
- beginning of sub-regex "father*"
- beginning of sub-regex "((mother)?father*)+".
I don't see for now any other way. Any clues nice welcome. Best regards.