Re: Regarding pattern matching

2007-05-24 Thread Jeff Pang
Dharshana Eswaran 写道: Hi All, I am trying to extract strings from few files. The content of the file reads as shown typedef struct { REFID_T pp_ref_id; /* destination */ CAUSE_T pp_cause;/* Reason registered */ STATE_T pp_state; /* State for

Re: Regarding pattern matching

2007-05-24 Thread Dr.Ruud
Dharshana Eswaran schreef: $xyz =~ /\s*(\w+)\s+(\w+);/; $b = $2; #variable name is stored here ... But the variables like pp_lac[COMMON_TYPE_MAX] and pp_plmn_list[COMMON_TYPE_MAX] are not getting stored because of the special character used inbetween the names. Then don't

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
How about this? #!/usr/local/bin/perl use strict; use warnings; my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */'; my @parts = $string =~ m/\S+?(\w+)\s+?\((\w+.*?)\)[EMAIL PROTECTED](\w+).*/; use Data::Dumper; print Dumper @parts;

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
On 5/17/07, Rob Coops [EMAIL PROTECTED] wrote: How about this? #!/usr/local/bin/perl use strict; use warnings; my $string = '#define MNSS_FACILITY_IND_ID (TF_MNSS_MESSAGE_CATEGORY + 0x01) /* @LOG MNSS_MESSAGE_T */'; my @parts = $string =~ m/\s+?(\w+)\s+?\((\w+.*?)\)[EMAIL

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Thank you But i want to try without using any perl modules. Can you suggest some way with no modules used in that? Thanks and Regards, Dharshana On 5/17/07, Rob Coops [EMAIL PROTECTED] wrote: On 5/17/07, Rob Coops [EMAIL PROTECTED] wrote: How about this? #!/usr/local/bin/perl use

Re: Regarding pattern matching

2007-05-17 Thread Rob Coops
Sure, though I do not see why you would not want to use strict and warnings (you should should should or the people on this list will hunt you down and ) anyway Data::Dumper was just there for convenience: #!/usr/local/bin/perl #use strict; #use warnings; my $string = '#define

RE: Regarding pattern matching

2007-05-17 Thread Moon, John
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,

Re: Regarding pattern matching

2007-05-17 Thread Matthew J. Avitable
Dharshana Eswaran wrote: 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,

Re: Regarding pattern matching

2007-05-17 Thread Dharshana Eswaran
Of Course Rob, i always use strict and warnings... Since i had to write a pseudocode, i did not write them. But i wil lsurely keep this in mind. :-) Thank you... :-) On 5/17/07, Rob Coops [EMAIL PROTECTED] wrote: Sure, though I do not see why you would not want to use strict and warnings (you