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.
我在这里有这个正则表达式:
"\d+.?\d*\^\d+\.?\d*"
它应该做的是在类似2^10的字符串中找到类似的东西,1*1+2^10*1但它会以1+2^10.
2^10
1*1+2^10*1
1+2^10
我究竟做错了什么?我认为这与.?
.
在正则表达式中,.字符代表“匹配任何字符”。你将不得不逃避它:
"\d+\.?\d*\^\d+\.?\d*"
您可以使用RegexPal尝试您的正则表达式