Hi All, I'm beginner to pattern matching in Perl and was writing a code to parse a string. I tried pretty hard to extract the words that are of interest from a string but had no luck.
Here is all-in-one-line string that I want to parse: $string = "biological process|mitosis|IEA|GO:0007067|MGD|na|biological process|cell cycle|IEA|GO:0007049|MGD|na|cellular component|intracellular|IEA|GO:0005622|MGD|na|molecular function|protein tyrosine phosphatase|IEA|GO:0004725|MGD|na|biological process|M phase of mitotic cell cycle|IEA|GO:0000087|MGD|na|biological process|protein amino acid dephosphorylation|IEA|GO:0006470|MGD|na"; I want to extract recursively all words delimited by two pipes ( | ) that follow a specific pattern like "process" or "component". For example, I want mitosis, cell cycle, M phase of mitotic cell cycles, and protein amino acid dephosphorylation, extracted that are associated with the pattern "process". I tried several combinations of the following code but it gets only one word or everything or nothing at all. while ($string =~ /process(\S+(?!\|)(\s\S+)*)/g) { print "\tbiological process\t$1\n"; } Correction to this code or an alternative suggestion is highly appreciated. Thanks a lot, Perdeep K. Mehta, Ph.D. Hartwell Center for Bioinformatics and Biotechnology St. Jude Children's Research Hospital 332 N. Lauderdale Street Memphis, TN 38105 phone: 901-495 3774 fax: 901-495 2945 email: [EMAIL PROTECTED] http://www.hartwellcenter.org _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs