Sandeep-

I agree with Mr Raven and Mr Walters, this looks like HTML/XML or 
something else in the SGML family. if you can use one of the ready made 
parsers that are already around for Perl, you will save yourself a lot of 
time.


Assuming you're using a variation of SGML that is too far from those with 
parsers to use one of them, I would suggest using the "not an X" trick.


for the sample:
>>$ref=" <bold> This a test <\/bold><med >";

i would suggest the pattern /(<[^>]+>)(.*?)/g

running your $ref through my pattern, (i dont have a lot of time and need 
a diversion so i can hopefully find a problem, hence why i'm doing this 
fast and not testing) will theoretically break it to:
" <bold>"
" This is a test "
"<\/bold>"
"<med >"

to be a little more ambitious, modify it to /(<\/?*([^>]+)>)(.*?)/g
and you can get what the tag is and do stuff based on it.


I have done something similar to that in the past for making a bb code on 
a webpage and having php run it through their Perl regexp since I needed 
to essentially create a markup language.

HTH

-Josh
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to