jqcoffey has asked for the wisdom of the Perl Monks concerning the following question:
I have been piecing together a Perl/javascript (my question is only on the Perl guts side of things) based UI to Text::Aspell. I am presented with a completed HTML document and tasked with spell checking all of the words (anything between > and <, effectively).
My problem is finding only the words (nothing inside <>'s) and associated byte position in the document. Once I have this, I can relatively easily perform my JS visual transformations on the HTML and then post back the appropriate info to do the actual replacement in Perl.
What I'm struggling with is the regex to use. I've mucked around with
$-[0]and
$+[0], but am now leaning towards a single s/.../function()/eg regex where the function does the dirty work of building the HTML I need to replace a spell checkable word with (just some nonesense).
The same regex needs to be used on both ends (display and final editing before saving in the database).
I really am totally out of starting places on this, as I have been through many iterations of regexes and logic. I'm not even sure if I should be using a regex, but rather a substring in a while loop... any hints, advice, explicit examples would be much appreciated.
Thanks,
Justin
|
|---|