I am trying to split a string in Javascript using a Regular Expression. My code is as follows:
var status = "This is a test http://yfrog.com/5y6eruj";
var regexp = /(http:\/\/yfrog\.com(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
matchParts = status.split(regexp);
alert(matchParts);
In Chrome and FF when I alert matchParts
it is an array containing the text and then the url. In IE however matchParts
is just the text and the url has vanished!
Either there is an odd bug in IE or my Regular Expression isn't quite right...please help!