标签: regex metacharacters
我想知道是否有元字符,比如?或*,可以在正则表达式中用作普通字符而不是元字符。
例如,我有以下文字:
"Hi. How are you? What time is it? Beep?"
我想使用正则表达式对每组以问号(?)结尾的单词进行子串。
因此导致:
Hi. How are you? What time is it? Beep?
谢谢
答案 0 :(得分:0)
您可以查找?后跟可选空格,并将其替换为?和此newline。
?
newline
正则表达式 \?\s?此处?已转义。
\?\s?
[?]\s? does the same.
[?]\s?
替换:替换为?\n
?\n
Regex101 Demo