extracting alphanumeric values following some given text in a sentence

时间:2015-06-15 15:06:20

标签: regex stanford-nlp

I want to extract some alphanumeric values in a sentence.The values will be after or before some given text pattern. I have already tries regexner tool of stanford nlp.But i want to do it using some other tool like tokenregex of parse. situation.To enter the building code is 123A.The access code is 456.There are many sentences like these two .I want to extract the code values from sentences like this.

1 个答案:

答案 0 :(得分:0)

最简单的答案是“寻找任意数量的字母,然后寻找至少一个(可以更多)数字,然后是任意数量的字母。”

所以你最终得到像/\w*\d+\w*/这样的东西。如果您使用的正则表达式引擎不理解\w\d,您也可以尝试使用/[a-z]*[0-9]+[a-z]*/

相关问题