D
Darius
Hi,
Here goes again. Please excuse the repeat question. But then, I got no
response that could be 'matched' as appropriate
I have many lines in a bad xml file that are like the long one below:
<word_word1 string="start" date="2004-09-02 07:33:22" id="2033878"
word_id="2000589" get_id="8647" ><word name="MOVIE"><film
title="S"things Gotta Give" the_number="531780"
/></word></word_word1><film title="S'"e Gotta Give"
the_number="531780" />
I don't want to try XML:arser yet, so, not caring about whether this
is an xml file or not, there are 2 occurences of "Gotta" in this
string and these 2
occurences need to be pre-fixed by "Somethings" between the first "=\"
just
before the "Gotta", and, the "Gotta"
So: ="S'"e Gotta Give" should become ="Somethings Gotta Give"
and ="S"things Gotta Give" should become ------ditto-----
etc.
e.g ="Something's Gotta Give" should become ="Somethings Gotta Give"
The characters before the Gotta and first =\" just before it, are not
static
so I can't use lookbehinds or can I?
I tried this so far:
while( $line=~/(.*)(=\")(.*?)(Gotta)/g ){
print "\n$2$3$4\n";
}
which gave me:
="S'"e Gotta
But I could't get the Gotta previous to this in the string and so I
am not able to repeat the while loop successfully.
Can anyone help me with this ? Thx
D
Here goes again. Please excuse the repeat question. But then, I got no
response that could be 'matched' as appropriate
I have many lines in a bad xml file that are like the long one below:
<word_word1 string="start" date="2004-09-02 07:33:22" id="2033878"
word_id="2000589" get_id="8647" ><word name="MOVIE"><film
title="S"things Gotta Give" the_number="531780"
/></word></word_word1><film title="S'"e Gotta Give"
the_number="531780" />
I don't want to try XML:arser yet, so, not caring about whether this
is an xml file or not, there are 2 occurences of "Gotta" in this
string and these 2
occurences need to be pre-fixed by "Somethings" between the first "=\"
just
before the "Gotta", and, the "Gotta"
So: ="S'"e Gotta Give" should become ="Somethings Gotta Give"
and ="S"things Gotta Give" should become ------ditto-----
etc.
e.g ="Something's Gotta Give" should become ="Somethings Gotta Give"
The characters before the Gotta and first =\" just before it, are not
static
so I can't use lookbehinds or can I?
I tried this so far:
while( $line=~/(.*)(=\")(.*?)(Gotta)/g ){
print "\n$2$3$4\n";
}
which gave me:
="S'"e Gotta
But I could't get the Gotta previous to this in the string and so I
am not able to repeat the while loop successfully.
Can anyone help me with this ? Thx
D