I have a table with a bunch of phone numbers queried from a database. I want to insert hyphens into the phone number so instead of: “0000000000” the user will see: “000-000-0000”. Not very good at regex but this is what I’ve tried so far:
$('.views-field-phone').each(function(){
$(this).insertAfter(/(.{3})/g,"-1-")
$(this).insertAfter(/(.{7})/g,"-1-")
});
maybe not optimal but…
or for your case…