Ramprasad A Padmanabhan wrote: > > I am writing a c program In which I have some heavy text parsing to do. > Unfortunately I am not very conversant with C or Regex in C
You can use Perl's regular expressions in C: http://www.regular-expressions.info/pcre.html > I have read about embedding perl into C programs, > > Now How Can I do this efficiently Have you read the perlembed.pod document? perldoc perlembed > Suppost I want to parse a Mail To: header and want to extract the emailid http://search.cpan.org/author/ABIGAIL/RFC_RFC822_Address-1.5/Address.pm http://search.cpan.org/author/MIYAGAWA/Email-Find-0.09/lib/Email/Find.pm > like take an example > > @strings = ('"Ram Prasad" <[EMAIL PROTECTED]> ', > '[EMAIL PROTECTED],[EMAIL PROTECTED]'); > > foreach (@strings) { > while(/([EMAIL PROTECTED])/g){ > push @emailids , $1; > } > } > > print "GOT ALL EMAILIDS in @emailids\n"; > > __END__ > > Now think of doing that in C. I will have to spend two weeks learning C > regex libraries before I can do this > > Instead Can I just embed this perl code in my c program > I will be happy if someone can give some links to examples on the net Have you read RFC2822 which describes the structure of email headers? Have you done a web search for C code that parses email headers? John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]