为什么看起来regexp' OR对订单敏感吗?

时间:2018-04-20 19:23:49

标签: python regex

print(nltk.regexp_tokenize('That U.S.A. poster-print costs $12.40...13.10', r"((?:(?:[A-Z]\.)+)|(?:\w+(?:-\w+)*)|(?:\d+(?:\.\d+)?))"))

输出:

"['That', 'U.S.A.', 'poster-print', 'costs', '12', '40', '13', '10']"

并且(按括号中的模式顺序改变):

print(nltk.regexp_tokenize('That U.S.A. poster-print costs $12.40...13.10', r"((?:(?:[A-Z]\.)+)|(?:\d+(?:\.\d+)?)|(?:\w+(?:-\w+)*))"))

输出:

['That', 'U.S.A.', 'poster-print', 'costs', '12.40', '13.10']

为什么这种情况下的订单很重要?

0 个答案:

没有答案