phorcon3 Posted November 28, 2009 Share Posted November 28, 2009 var string = ' word word. '; so, all words which don't have a period as the last character should be replaced with invalid string.replace(/[a-zA-Z]{1,}[^\.]/gi, 'invalid'); but [^\.] doesnt work, does anyone else know what to put in instead? Link to comment https://forums.phpfreaks.com/topic/183172-regex/ Share on other sites More sharing options...
.josh Posted November 28, 2009 Share Posted November 28, 2009 string.replace(/[a-z]{1,}([^.a-z])/gi, 'invalid$1'); Link to comment https://forums.phpfreaks.com/topic/183172-regex/#findComment-966758 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.