<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<style type='text/css'>
span {
color: blue
}
</style>
<script type='text/javascript'>
$(window).load(function(){
$('p').html(function(index, value) {
return value.replace(/(\d+)/g, '<span>$1</span>');
});
});
</script>
</head>
<body>
<p>Text and numbers: 123</p>
<p>123 and text</p>
</body>
</html>