ok, essentially, I'm performing a find and replace on data that exists in a large XML file (derived from a Visio) I am finding data in the XML file from a list I've derived from an excell spreadsheet Also from that spreadsheet I have data I want to replace the old data with.
The $infile...
Well, essentially, I can use pos() to find the position returned by (*?), or $1. I want to take $1 and see if it matches some other stuff, and if so, replace the value of $1 <i>at</i> whatever was returned by pos(). Perhaps some variant of:
while($infile=~/<Text>(.*?)<\/Text>/gs){
$itsPos =...
YES!!! that is exactly what I needed. I was concerned that within the block, when I invoked another regex, it would lose it's position. The marker replacement was an un-graceful approach to tracking the position of the tag. Thank you for you insight. Expect more Perl questions from me!
Speaking...
Ok, I got that figured out.
$infile =~ s/(<Text>)(.?)(<\/Text>)/$marker/s; Now I just need to figure out how to call it iteratively for each instance. For some reason, Perl isn't letting me write a function that contains that regex to be called.
I am attempting to 'find and replace' content in a rather large XML file. Basically, I am exporting data from an excel spreadsheet into a Visio. Some of the fields don't match directly due to existence of newlines, spaces, special characters and other subtle differences between tags. Roughly...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.