This is what I have done so far,
$('.name').keyup(function () {
var $th = $(this);
$th.val($th.val().replace(/[^a-zA-Z' ]+( [A-Za-z' ]+)*$/g, function (str) {
return '';
}));
});
The above expression allows me to enter A-Z and ' and space. But I want only one space afer a character or word.
Ex. Hello World is ok
but Hello World should not be accepted.