[英]How to exclude some word in string in regex (to replace using javascript)
我想在两个 (") 之间的 select 单词并排除 (") 之外的其他单词以使用 javascript 替换替换字符串。 这是我的字符串
接待员:“好的,请稍等。” 过了一会,接待员笑道:“恭喜你,获得了转职考试免试证书,有了它,达到一定等级就可以使用了。完成转职任务后,就可以直接转专业,很方便的小礼物。”
我想 select "Okay, please wait a moment."
以及"Congratulations, you have obtained a certificate of exemption from the exam for job transfer. With it, you can use it after you reach a certain Level. After completing the job transfer task, you can directly transfer to a specific occupation, a very convenient little gift."
并排除其他。
我尝试/".+"/g
它包括从"okay
到gift."
并且不排除其他请帮助我,谢谢
我认为它可以工作: /("[^"]+")/g
此正则表达式匹配任何具有初始"
的单词,一个或多个不同于"
的字符,最后以"
结尾的单词您可以在此regex101图像中看到它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.