Thanks for ur kind reply.
Actually im working in an concern as text file to sgml/xml/html conversion and validation programmer(Trainee). what i asked as an example is not only for HTML but for all the mark up languages.
secondly, Im working with the plain text files with some short tags applied in them to convert them into some markup languages(XML or SGML) under some dtd specification.
input:
[[tx]][[nm]]Murugesan[[/nm]]is trainee perl programmer.[[/tx]] [[tx1]][[nm]]Murugesan[[/nm]]is trainee perl programmer.[[/tx1]]
output:
<customer><name type="rrd">Murugesan</name> is trainee perl programmer +</customer> <vendor><name type="integra">Murugesan</name> is trainee perl programm +er</vendor>
my next doubt is, while im converting above input text inside some short tag(nesting), what im doing now is im using the subroutines in regular expression to convert them into the output format as mentioned in my below code.
s/\[\[tx\]\](.*?)\[\[\/tx\]\]/'<customer>'.&txt($1).'<\/customer>'/egs +i; sub txt{ my $a=$_[0]; $a=~s/\[\[nm\]\](.*?)\[\[\/nm\]\]/<name type="rrd">$1<\/name>/gsi; return $a; }
In the above coding i have just done for single level nesting of name. some times more number of nestings are present. Is this method of using subroutines inside the regular expression which lead to nested subroutines is o.k or is there any other effecient method available.
In reply to Re: Re: nested tag matching
by Anonymous Monk
in thread nested tag matching
by murugu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |