[example run]
var str = '111 sdfgdf g 111 sdf sd f111324 232111343';
var str2 = 'sdfgdf g 11_1 sdf sd f11324 232343';
function count(s,r){
try{return s.match(new RegExp(r,'gm')).length}catch(e){return 0}
}
alert(count(str,'111'));
alert(count(str2,'111'));
[/example]
|