Oops!!! Sorry, It is ([A-Z0-9_]+). It was a typo in my mail. And your suggestion worked. Thank you. But in the string which u had suggested, [,\s*\/*]?, here \s* => tells spaces are optional, /\* sells the beginning of the comment, I am unable to understand what these in a square bracket along with a ? mean?
Thanks and Regards, Dharshana On 7/31/07, Andrew Curry <[EMAIL PROTECTED]> wrote: > > > Try > > if($str5 =~ /\s*(\S+)\s*=\s*(\S+)[,\s*\/*]?/) > > I cant see how your > > ([A-Z_]+) > Will match your DL_FEM_ADJ1 as this has a number on it? > > > -----Original Message----- > From: Dharshana Eswaran [mailto:[EMAIL PROTECTED] > Sent: 31 July 2007 13:17 > To: Perl Beginners > Subject: String Manipulation > > Hi All, > > I have a string which reads > $str5 = " DL_FEM_ADJ1 = DL_FEM_LINE_FIRST, /* Keep the adjacent ones > consecutive */"; > > Here i need to consider the variable and its value, ignoring the comment. > > I have a pattern which reads > > if($str5 =~ /\s*([A-Z_]+)\s=\s(\w+),*/) { > print "$1 and $2\n"; > } > > The above works, if the string is " DL_FEM_SCREEN_ADJ1 = > DL_FEM_SCREEN_NO_SECOND_LINE_FIRST," (without the comments) > > I am unable to come up with a pattern which would ignore the comment and > gives me the substrings which i want. I need to read DL_FEM_SCREEN_ADJ1 > and > DL_FEM_SCREEN_NO_SECOND_LINE_FIRST only. > > The input string can either occur with comments or without comments, since > the input keeps changing. The input provided here is a sample input. > > Can anyone please guide me in this? > > Thanks and Regards, > Dharshana > > > This e-mail is from the PA Group. For more information, see > www.thepagroup.com. > > This e-mail may contain confidential information. Only the addressee is > permitted to read, copy, distribute or otherwise use this email or any > attachments. If you have received it in error, please contact the sender > immediately. Any opinion expressed in this e-mail is personal to the > sender > and may not reflect the opinion of the PA Group. > > Any e-mail reply to this address may be subject to interception or > monitoring for operational reasons or for lawful business practices. > > > > >