Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 Regex 世界的新手,想在示例中的单词之后找到第一个序列:
ALEEA NARCISELOR BL. A3 NR. 1 SC. B AP. 68
我想找到后面的第一个词NR,在这种情况下是1,但可能是A1或A,但在这种情况下是1。
NR
1
A1
A
什么是正则表达式。
谢谢!
您可以使用的模式:
(?<=NR\.)\s?\w+
演示:示例
这应该做
(?<=(\s|^)NR\.\s*).*?(?=\s|$)