Chris, This is along the same lines as what I do later to get my $searchable string, basically pulling out any offending stuff and working from there -- you use matches where I used substitutions, but the idea is similar.
I've just noticed that I was not sufficiently specific in describing my problem: I don't actually have a problem with pulling the data out for use in the created (visible) header, my problem is locating that date in the document for use as an anchor in tearing down the old document and building a new one. The real problem is that I have to work "in situ", as it were, not disturbing the framework of the existing document. As such, I have to work directly within the context of that document. If I change the document so that I can work with it, it is most likely no longer a viable, usable RTF document. And my $searchable string is completely divorced from the actual content of the file (bears no resemblance to it), so it can't be used for setting parsing pointers. Hmm, a sudden thought: maybe instead of trying to maintain the original file intact, I should simply get rid of all the RTF formatting and use Burke's RTF::Writer to build the output files from scratch. I'm going to explore this for a while. In the code snippet I included originally, there's a bunch of stuff going on that you can't really understand, taken out of context as it was. Basically, I have to split the original document up into cohesive parts and then put it back together again in a different order -- having removed and inserted data along the way. There is a ton of mumbo-jumbo in the document that you only see when you look at it as straight text, much of it in the RTF header. I have been trying to use this date -- the first actually visible text in the document when viewed in Word -- as the anchor for an indexing pointer as I parse the file. Perhaps this is the concept I should look at again from scratch. Best regards, -Brian ps - I hope you don't mind my "Stream of Consciousness"/"thinking out loud" style here. :D _________________________ Brian H. Oak CISSP CISA Acorn Networks & Security <http://acornnetsec.com/> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Wagner Sent: Tuesday, February 21, 2006 10:36 To: [email protected] Subject: Re: MSWord RTF output driving me insane! At 08:50 AM 2/21/2006 -0700, Brian H. Oak wrote: >As you can see, that date figures prominently in my code -- it appears >four times in the snippet above. Imagine my consternation when I >found out that this date can appear any one of several ways (this is >the actual text from RTF files): > >{\b\insrsid15483745 08/02/2005\cell } >{\b\insrsid15483745 08/02/05\cell } >{\b\insrsid15483745 08/02/}{\b\insrsid16739478 2005\cell } >{\b\insrsid15483745 08/02/}{\b\insrsid16739478 05\cell } >{\b\insrsid15483745 08/}{\b\insrsid16739478 02/2005\cell } >{\b\insrsid15483745 08/}{\b\insrsid16739478 02/05\cell } >{\b\insrsid15483745 08/}{\b\insrsid16492297 02/}{\b\insrsid16739478 >2005\cell } >{\b\insrsid15483745 08/}{\b\insrsid16492297 02/}{\b\insrsid16739478 >05\cell } I think if u can isolate the date super string there's hope. $string = '{\b\insrsid15483745 08/}{\b\insrsid16492297 02/}{\b\insrsid16739478 05\cell }'; ($datestruct) = $string =~ m/(\{\\b\\insrsid.+)\\cell \}/; $datestruct .= "}"; @datecomps = $datestruct =~ m/\{\\b\\insrsid\d+ (.+?)}/g; print @datecomps; ########### 08/02/05 That should work even if the date is chopped into single characters. -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 00000100 _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
