这是一个包含公式和生物代码的巨大文件的样本。有些行以下列字符开头:
Sheep"-head`ed, // followed by some normal words
Mon`o*car*bon"ic, // followed by some normal words
mon`o*car"di*an, // followed by some normal words
Pol`y*chro"mate, // followed by some normal words
sheep"cot`, // followed by some normal words
baad, // followed by some normal words
我是正则表达式的新手。现在我正在尝试使用 TPerlRegEx(PCRE 库的包装器)。我需要提取:
Sheep"-head`ed,
Mon`o*car*bon"ic,
mon`o*car"di*an,
Pol`y*chro"mate,
sheep"cot`,
baad,
你能帮我写一个正则表达式吗?
非常感谢。
编辑:
感谢大家的帮助。如果它们之间有法线:
Sheep"-head`ed, // followed by some normal words
Mon`o*car*bon"ic, // followed by some normal words
New test, //I do not want two or more than two words that end with comma.
mon`o*car"di*an, // followed by some normal words
Pol`y*chro"mate, // followed by some normal words
sheep"cot`, // followed by some normal words
baad, // I want this one word that ends with comma
我还想要:
Sheep"-head`ed,
Mon`o*car*bon"ic,
mon`o*car"di*an,
Pol`y*chro"mate,
sheep"cot`,
baad, // I want this ONE word that ends with comma.
再次感谢你。