Javascript isText

This snippet will test for a letter followed by any number of letters or ‘-‘ or ‘.’.

[js] function isText( text ) { var regex = /^[a-zA-Z][a-zA-Z-.]*$/; return regex.test( text ); } [/js]

Posted by Andrew     

Comments (0)