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.
我试过这个:
(?=<).+(?<=>)
但它也总是匹配尖括号:
那么我怎样才能得到没有括号的文本呢?(它应该匹配括号中适合一行的任何文本)。
这很容易,.+吃掉所有内容直到行尾(请记住,点匹配所有内容,包括>和<此处)。 要么使用惰性量词(演示)
.+
>
<
(?<=<).+?(?=>)
或否定字符类(演示)
<([^>]+)