Created
June 9, 2013 08:00
-
-
Save tedzhou/5742746 to your computer and use it in GitHub Desktop.
wrap regex key words
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created with IntelliJ IDEA. | |
* User: ted | |
* Date: 13-6-9 | |
* Time: 下午3:59 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
// copy from canjs | |
// 把正则的敏感词转起来 | |
var wrapQuote = function(str) { | |
return (str+'').replace(/([.?*+\^$\[\]\\(){}|\-])/g, "\\$1"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment