
steve
Deleted
Mar 1, 2000, 6:10 PM
Post #1 of 3
(1669 views)
|
Pattern Matching Problem
|
Can't Post
|
|
Hello, I have a problem I can't figure out. What I am trying to do is parse a text file (HTML) that looks something like this. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> I haven't been able to get this line. I haven't been able to get this line. My successful part. <BREAKPOINT> And more text. And more text. You get the idea. </pre><HR></BLOCKQUOTE> My goal is to load everything up to the "<BREAKPOINT>" into one variable, and everthing after into another. Here is what I came up with but it doesn't work. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> open(TMPL, "admin.tmpl.html") @tmpl = <TMPL>; close(TMPL); $tmpl = join('', @tmpl); if ($tmpl =~ /(\w*|\n*)<BREAKPOINT>([\w*|\s*])/g) { $begin = $1; $end = $2; } </pre><HR></BLOCKQUOTE> I just can't figure out the pattern matching. The best I've been able to do is have $begin contain everything on the SAME line but before "<BREAKPOINT>". Any pointers in the right direction would be appreciated. I ordered The Pearl Cookbook from Amazon, hopefully that will help me more than this Pearl For Dummies book. Thanks, Steve
|