Subject: Regarding pattern matching Hi All,
I am trying to extract few strings from a text file. The pattern of the text stored in the file is as follows: #define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */ I need to extract MNSS_FACILITY_IND_ID, TF_MNSS_MESSAGE_CATEGORY + 0x01 and MNSS_MESSAGE_T. I tried next unless /#define\s+(\w+)\s+\(([^)]+)\s+\/[EMAIL PROTECTED](\w+)\*\//; my $name = $1; my ($base, $offset) = $2 =~ /\w+/g; my $Struct = $3; I am unable to find out the error. Can anyone help m in this? Thanks and Regards, Dharshana [>>] One way my $data = q{#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */}; my @list = $data =~ /^#define\s*(.+)\s*\((.+)\)\s*\/\*\s*(.+)...$/; print "$_\n" for (@list); hope this helps jwm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/