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.
我想知道是否有元字符,例如?或 *,可以在正则表达式中用作普通字符而不是元字符。
例如,我有以下文本:
"Hi. How are you? What time is it? Beep?"
我想使用正则表达式对每组以问号 (?) 结尾的单词进行子串化。
因此导致:
Hi. How are you? What time is it? Beep?
谢谢
您可以查找?后跟可选空格并将其替换为 a?和newline这样的。
?
newline
正则表达式: \?\s?这里?被转义了。
\?\s?
[?]\s?做同样的事情。
[?]\s?
替换:替换为?\n
?\n
正则表达式 101 演示