Hi All, I have a text file as shown below. How do I match patterns like the following:
Pattern to be matched: ========================= #ifndef def ...... (anything except #if) #else def ....... (anything except #if) #endif def My Input Data: ===================================================== #ifndef def DELETE sys1..tbl1 #endif def SELECT col1, col2, col3 #ifndef def FROM sys1..tbl1 #else def FROM sys1..tbl2 #endif def WHERE schdid is not null ===================================================== What I tried is below (but did not work since it captured patterns which had "#if" nested within the main pattern). $line1 =~ m/#ifndef\s+def(.*?)#else\s+def(.*?)#endif\s+def/isg Any suggestions Please !!! Thanks, Ramesh __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]