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.
如果包含特定字符串,则显示整行的正则表达式是什么?
源字符串是“ABC:我是你的父亲”,我需要在“ABC:”之后显示所有内容,所以最终输出是“我是你的父亲”。
谢谢。
此正则表达式会将所有内容abc:放入捕获组 2
abc:
^ABC:[[:space:]](.*)
输入文本: ABC: i am your father
ABC: i am your father
火柴:
[0] => ABC: i am your father [1] => i am your father