Open ejoubaud opened 11 years ago
I have same problem:
var array = s.words(" A01 , 'B02' ; 'C03' ", /\W+/);
// throws SyntaxError: Invalid regular expression: /^W++|W++$/: Nothing to repeat
I fixed it with following code: (is not general fix, but give an idea on how should be fixed)
if (isBlank(str)) return [];
return = trim(str, /\W/).split(/\W+/);
See this fiddle: http://jsfiddle.net/mauvega/ymupb7rd/
As soon as I add a quantifier in
words
' pattern argument, I get an error I wouldn't with the original JS method split:See this jsfiddle: http://jsfiddle.net/ejoubaud/J9gn9/
Unrelated: Why use the obscure name
words
instead of the basic JS/Ruby well-knownsplit
? I'd strongly +1 an alias.Apart from that awesome job with this lib guys, thank you very much.