我在 jquery 纺织解析器中有这些代码行:
re = new RegExp('"\\b(.+?)\\(\\b(.+?)\\b\\)":([^\\s]+)','g');
r = r.replace(re,'<a href="$3" title="$2">$1</a>');
re = new RegExp('"\\b(.+?)\\b":([^\\s]+)','g');
r = r.replace(re,'<a href="$2">$1</a>');
这些代码行搜索字符串,如
"hello this is an embedded link":http://www.google.com
并将它们替换为
<a href="http://www.google.com">hello this is an embedded link</a>
但是,解析器无法识别在右引号之前带有句点的字符串:
"This is also a link.":http://www.google.com
如何更改这些行上的正则表达式以允许句点在结束引号之前?如果有帮助,我可以发布更多信息和线路。我只是不知道如何编写正则表达式..