[英]REGEX, get text and character across multiple lines
我想去
await ƒS.Speech.tell(
characters.narrator,
"Some text here"
);
await ƒS.Speech.tell(characters.anothername, "Some other text"
);
通过正则表达式以下
characters.narrator, "Some text here"
characters.anothername, "Some other text"
但是,到目前为止,我只能通过以下方式获取引号之间的文本
"(.*?)"
如何扩展 REGEX 以获得它?
您可以像这样扩展模式:
\w+(?:\.\w+)+,\s+"[^"]*"
解释
\w+
匹配 1+ 个单词字符(?:\.\w+)+
重复匹配 1+ 次.
又是 1+ 字字符,\s+
匹配逗号和 1+ 个空白字符(也可以匹配换行符)"[^"]*"
匹配"..."
请参阅regex101 演示。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.