Building several parsing modules

Robert Neville r0bert_neville310 at yah00.com
Sun Mar 18 17:46:53 EDT 2007


Basically, I want to create a table in html, xml, or xslt; with any
number of regular expressions; a script (Perl or Python) which reads
each table row (regex and replacement); and performs the replacement
on any file name, folder, or text file (e.g. css, php, html).  For
example, I often rename my mp3 (files); the folder holding the mp3
files; and replace these renamed values in a playlist/m3u/xml file. 

The table should hold clean regular expressions with minimal escaping.
The regular expressions would incorporate multiple lines and complex
expressions (e.i. symbolic grouping, back referencing, negative
lookahead). The table would serve as a preset file for any replacement
task. It also contains short description column for each regular
expression. The table could contain 1 to 1000 regular expressions; and
the input file could have 1000 to ten thousand lines as well. SED
would become messy here.

I am just starting out with building the logic and pseudo-code.  I am
hoping for any examples where these libraries have been applied. Links
and guides would help since I am just starting out with the language.
I need suggestions and examples on reading input by line; managing
large data sets; iterating through an xml/html structure; and various
parsing techniques. 

I built a solution in VBScript and VBA, but it had several limitations
like operating on one platform and did not have full Perl regular
expression support. In addition, it is attached to an Access database.
The solution would parse and add headers to the data. It would parse
the data with the headers and insert it into a table. It had over
fifteen modules for repetitive parsing tasks to build a importable
data set. VBScript Regexes are not as powerful as Perl or even sed.

This request is large, yet someone with command of the language could
give guidance on the basic framework to kickstart my efforts.
Basically, I need someone to say start here; then proceed to this
function; then look into these libraries; so on. 



More information about the Python-list mailing list