Dear All, Thanks to all for the advices. Currently I have decided to use Bill's solution, because the file which I use is NOT XML/HTML but it is some other propriety Markup language called XyAscii. This ML doesn't have mandatory end tags and also it doesn't have 'DTD like' coding guidelines and hence I need to build my own parser, which would NOT be perfect as first version.
Once again I would like to thank you all for your support. Thanks & Regards, Sandeep Deshpande -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: Wednesday, September 21, 2005 11:13 PM To: [email protected] Subject: Re: REgExp 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 _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
