in reply to regex help
perl -n00e 'print if /^\d/;' filename
However, since the second prototype doesn't have a blank line, you need to take that into account, with something like:
perl -n00e '/^(\d(.(?!\nPrototype))+)/ms; print $1' filename
This will search for any paragraph that starts with a number, then look for as many characters as it can find that aren't followed by \nPrototype.
If the file doesn't have a blank line before each function definition (except the first), then this won't work, though.
I noticed your code references an HTML file. Are we looking at the raw file here, or the cut-n-paste from a browser? If the raw file is laid out with HTML tags, that will complicate things, and these solutions may not work.
|
|---|