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.
我的示例文本是
A 12324567#JAIEKLLIMdata B
并尝试提取以 A 开头并以 B 结尾的字符串
我的正则表达式是
"\AA [A-Za-z0-9]\ZB"
或者
"^A[A-Za-z0-9]B$"
尝试运行此正则表达式时找不到匹配项。有什么建议我哪里出错了吗?
你的第二个正则表达式几乎可以工作,但它只有在字符串正好是三个字符长时才有效。尝试
"^A[A-Za-z0-9 #]*B$"
(您还需要在字符类中包含#和)。space
#
space