Revision: 19056
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 15, 2009 12:38 by cuimingda
Initial Code
function pick(str, re) { var result = str.match(re); return (result && result.length === 2) ? result[1] : result; } var str = "tel: 13512345678"; var tel_a = pick(str, /tel:\s?(\d+)/); var tel_b = pick(str, /tel:(\d+)/); // return 13512345678 alert(tel_a); // return null alert(tel_b);
Initial URL
http://oragg.com/2009/10/snipplr-for-wordpress.html
Initial Description
Initial Title
pick a certain substring from a string by regular expression
Initial Tags
Initial Language
JavaScript