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.
我正在编写一个匹配的正则表达式fooSVM??!。我想匹配SVM这个字符串,这意味着我需要从foountil meet?或!. 请注意,SVM可能是其他 Unicode 字符。
fooSVM??!
SVM
foo
?
!
我试过foo(.*)[?!]*但似乎没有用。
foo(.*)[?!]*
如果不能有换行符,则可以这样做:
foo([^?!]+)[?!]
并检索第一组。
foo # Find "f", then "o", then "o", ( # begin capture [^?!] # followed by any character which is not "!" or "?", + # once or more ) # end capture [?!] # followed by either a "!" or a "?"