Re: string split with regex
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: string split with regex

From: Adrian Parker <apparker@nospam.com>
Date: Wed Sep 28 2005 - 18:37:04 CEST

"ZER0" <zer0.shock@libero.it> wrote in message
news:c634rrielt4x.dlg@ID-171124.news.individual.net...
> var str="AB1.2CD34";
> alert(str.match(/[0-9\.]+|[A-Za-z]+/g));

What am I missing, the following returns a zero length array.

function splitit(str) {
  var splitz = str.split(/[0-9\.]+|[A-Za-z]+/g);
 alert(splitz.length);
}

splitit("B1.2CD34");
Received on Tue Oct 18 03:32:00 2005