kevinkorb Posted July 18, 2006 Share Posted July 18, 2006 $string = 'the rapist 4';I want to remove all non-alpha characters to produce$new_string = 'therapist';Thanks a bunch... I'm sure this is cake for most of you. Link to comment https://forums.phpfreaks.com/topic/14974-remove-all-non-alphabetical-characters/ Share on other sites More sharing options...
shoz Posted July 18, 2006 Share Posted July 18, 2006 [code]<?php$string = 'the rapist 4';$string = preg_replace('/[^a-zA-Z]/', '', $string);echo $string;?>[/code] Link to comment https://forums.phpfreaks.com/topic/14974-remove-all-non-alphabetical-characters/#findComment-60151 Share on other sites More sharing options...
effigy Posted July 18, 2006 Share Posted July 18, 2006 Are you only working with ASCII? Link to comment https://forums.phpfreaks.com/topic/14974-remove-all-non-alphabetical-characters/#findComment-60183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.