Re: nested replace string

2005-04-11 Thread Dave Gray
 Please help me in where I am going wrong and suggest me the solution.

Since you have the data in nice XML format, why not use an XML parser
instead of parsing it yourself?

http://perl-xml.sourceforge.net/faq/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




nested replace string

2005-04-08 Thread N. Ganesh Babu
Dear All,
I am converting citations present in books to xml coding using regular 
expressions. Anybody can suggest best resources on this topic.
Here I am having one small problem. Please help.

citation 
id=c7refbookrefauthfnameD./fnamesurnameTurnbull/surname/refauth 
in booktitleSolid State Physics/I: IAdvances in Research and 
Application,/booktitle edited by 
refauthfnameF./fnamesurnameSeitz/surname/refauthand 
refauthfnameD./fnamesurnameTurnbull/surname/refauth, 
(publisherAcademic/publisher, New York, date1956/date), Vol. 
volume3/volume,  p. pages226/pages/lt

With the help of regular expression I have modified the text into these 
tags.

Now I want to change the refauth tags after edited by string into 
editor tags. I am changing the whole file with $line=FIN.

I have written the following code. But I can not able to print the 
desired output. In FOUT I am getting same as input. 

   $line=~s!``(.+)''!``title$1/title''!g;
**while($line=~m!edited by\s?(.+?)\(!g){$ed=$1;$ed=~s!refauth!editor!g;}
   print FOUT $line;
Please help me in where I am going wrong and suggest me the solution.
Regards,
Ganesh
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response