[英]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.