Since I started writing this question, I think I figured out the answers to every question I had, but I thought I\'d post anyway, as it might be useful to others and more cl
If I recall correctly (and I could be very wrong here), the split method was implemented in javascript before the regex engine was in wide use, so it's presumably for backward compatibility.
String.split
accepts either a string or regular expression as its first parameter. The String.match
method only accepts a regular expression.
I'd imagine that String.match
will try and work with whatever is passed; so if you pass a string it will interpret it as a regular expression. The String.split
method doesn't have the luxury of doing this because it can accept regular expressions AND strings; in this case it would be foolish to second-guess.
Edit: (From: "JavaScript: The Definitive Guide")
String.match
requires a regular expression to work with. The passed argument needs to be a RegExp
object that specifies the pattern to be matched. If this argument is not a RegExp
, it is first converted to one by passing it to the RegExp()
constructor.