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.
给定字符串以开头,我需要能够匹配字符串中的价格值Shipping (UK):</span>
Shipping (UK):</span>
细绳
Shipping (UK):</span>£2.95
到目前为止的正则表达式
(?<=\):<\/span>).*
我试图做这样的事情......
(?<=\Shipping (UK):<\/span>).*
但这不起作用,构造这个正则表达式的正确方法是什么?
您需要转义当前正则表达式中的括号以使其匹配:
(?<=Shipping \(UK\):<\/span>).*
另外,Charmander 是正确的,你不想要简写\S,你只想要S.
\S
S