multiple regex pattern matching per line?

D

Darius

Hi All,
I need to correct the title below. Can you help?

Lets say I have a line like this 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'&quote Gotta Give"
the_number="531780" />

This should be one continuous line, no new lines inbetween.

How do I correct the tag 'title' so that its ALWAYS correct and reads
as title="Somethings Gotta Give"

So there are 2 changes required here..It should basically become
this:-
<word_word1 string="start" date="2004-09-02 07:33:22" id="2033878"
word_id="2000589" get_id="8647" ><word name="MOVIE"><film
title="Somethings Gotta Give" the_number="531780"
/></word></word_word1><film title="Somethings Gotta Give"
the_number="531780" />

Please help urgently. Thanks
D
 
B

Brian McCauley

Darius said:
<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'&quote Gotta Give"
the_number="531780" />

This should be one continuous line, no new lines inbetween.

How do I correct the tag 'title' so that its ALWAYS correct and reads
as title="Somethings Gotta Give"

So there are 2 changes required here..It should basically become
this:-
<word_word1 string="start" date="2004-09-02 07:33:22" id="2033878"
word_id="2000589" get_id="8647" ><word name="MOVIE"><film
title="Somethings Gotta Give" the_number="531780"
/></word></word_word1><film title="Somethings Gotta Give"
the_number="531780" />

Can you explain how a human would be expected to know how to achive this
(without prior knowledge of the film title)?
 
T

Tad McClellan

Darius said:
I need to correct the title below. Can you help?

Lets say I have a line like this 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'&quote Gotta Give"
the_number="531780" />

This should be one continuous line, no new lines inbetween.


Have you seen the Posting Guidelines that are posted here frequently?

If you say it "in Perl" then you don't need ambiguous caveats like that:

my $line = '<word_word1 string="start" date="2004-09-02 07:33:22"'
. ' id="2033878" word_id="2000589" get_id="8647" >'
...

How do I correct the tag 'title'


There *are no* "title" tags in the data you posted.

There are only "word", "word_word1" and "file" tags.

so that its ALWAYS correct and reads
as title="Somethings Gotta Give"


How are we supposed to know that a double quote should be
replaced with "ome" ?

So there are 2 changes required here..

How are we supposed to know that "'&quote" should be
replaced with "omethings" ?

Please help urgently.


If it is urgent, then Usenet is the wrong place to go!
 
A

Anno Siegel

Tad McClellan said:
[...]
Please help urgently.


If it is urgent, then Usenet is the wrong place to go!

....but if you do, pleading urgency is unwise. You might as well jump up
and down waving your arms in a crowd. It will win you about as much
sympathy.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top