FD_F Posted November 28, 2009 Share Posted November 28, 2009 i have string to clear example: sdf343-5^% sd fsd%6 how can i clear what NOT [A-Z][a-z][0-9] - and spaces the result should be in this case : sdf343-5 sd fsd6 there is any way give match() flag to do this ? (any other idea will be good) Link to comment https://forums.phpfreaks.com/topic/183211-clear-string/ Share on other sites More sharing options...
.josh Posted November 28, 2009 Share Posted November 28, 2009 someString = someString.replace(/[^-a-z ]/gi,''); Link to comment https://forums.phpfreaks.com/topic/183211-clear-string/#findComment-967048 Share on other sites More sharing options...
FD_F Posted November 28, 2009 Author Share Posted November 28, 2009 thanks in the end i did str = str.replace(/[^-a-z 0-9]/gi,''); Link to comment https://forums.phpfreaks.com/topic/183211-clear-string/#findComment-967143 Share on other sites More sharing options...
.josh Posted November 28, 2009 Share Posted November 28, 2009 oh sorry, forgot about the digits. Link to comment https://forums.phpfreaks.com/topic/183211-clear-string/#findComment-967159 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.