简体   繁体   English

Javascript正则表达式可去除双引号之间的内容

[英]Javascript regular expression to strip out content between double quotes

I'm looking for a javascript regex that will remove all content wrapped in quotes(and the qoutes too), in a string that is the outlook format for listing email addresses. 我正在寻找一个JavaScript正则表达式,它将以字符串形式(用于列出电子邮件地址的Outlook格式)删除所有用引号引起来的内容(也包括qoutes)。 Take a look at the sample below, I am a regex tard and really need some help with this one, any help/resources would be appreciated! 看看下面的示例,我是一个正规表达式专家,确实需要一些帮助,任何帮助/资源将不胜感激!

"Bill'sRestauraunt"BillsRestauraunt@comcast.net,"Rob&Julie"robjules@ntelos.net,"Foo&Bar"foobar@cstone.net

假设没有嵌套的引号:

mystring.replace(/"[^"]*"/g, '')

试试这个正则表达式:

/(?:"(?:[^"\\]+|\\(?:\\\\)*.)*"|'(?:[^'\\]+|\\(?:\\\\)*.)*')/g

Here's a regex I use to find and decompose the quoted strings within a paragraph. 这是我用来查找和分解段落中带引号的字符串的正则表达式。 It also isolates several attendant tokens, especially adjacent whitespace. 它还隔离了几个伴随令牌,尤其是相邻的空格。 You can string together whichever parts you want. 您可以将所需的任何部件串在一起。

var re = new RegExp(/([^\s\(]?)"(\s*)([^\\]*?(\\.[^\\]*)*)(\s*)("|\n\n)([^\s\)\.\,;]?)/g);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于在某些字符之间查找双引号的 Javascript 正则表达式 - Javascript regular expression to find double quotes between certain characters 如何在javascript中使用正则表达式选择不在双/单引号之间的数字 - how to select numbers that is not between double/single quotes with regular expression in javascript 字符不出现在双引号之间的正则表达式 - Regular Expression for a character not appearing between double quotes 转义双引号正则表达式JavaScript - Escape double quotes regular expression JavaScript Javascript正则表达式,用于删除除双引号之间的空格以外的所有空格 - Javascript Regular Expression for Removing all Spaces except for what between double quotes 正则表达式在javascript中用双引号提供时不起作用 - regular expression not working when provided in double quotes in javascript Javascript正则表达式用双引号将未引号的JSON值(NOT键)包装起来 - Javascript Regular expression to wrap unquoted JSON Values (NOT keys) with double quotes 正则表达式在 JavaScript 中的键周围添加双引号 - Regular Expression to add double quotes around keys in JavaScript 正则表达式在javascript中的值和键周围添加双引号 - regular expression add double quotes around values and keys in javascript Javascript 正则表达式按句点分割字符串,不在双引号中 - Javascript regular expression split string by periods not in double quotes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM