split function. Firefox will happily accept this and works fine but IE doesn't. After some searching it appears that Firefox might be the odd one out and that it's non-standard to pass in a regex.
So what do you do if you want to split up a string based on a regular expression or rather a rule that can't be simply expressed in the way that the split function wants it? Wouldn't it be nice if you could ask if a string matches a regex but then use certain matched bits of the string in your next few lines of code?
Well you can, simply use the
RegEx to pull them out.
1234-ABC is your text, and you want the numbers as one part and the characters as another then you would use this regular expression to match on:
^([0-9]*)-([A-Z]*)$. You can then get hold of the matched numbers bit with
RegEx.$1 and the letters bit with