squiblo Posted July 11, 2010 Share Posted July 11, 2010 The below code is what I currently have, I also want to replace single quotes (inverted commas, apostrophe, whatever you call them) but have no idea how to do this. Thanks. $fname_test = eregi_replace("([A-Z]+)","",$fname); Link to comment https://forums.phpfreaks.com/topic/207416-eregi_replace/ Share on other sites More sharing options...
xcasio Posted July 11, 2010 Share Posted July 11, 2010 Simply add the character after (or before) A-Z: $fname_test = eregi_replace("([A-Z']+)","",$fname); Is this what you were trying to do? Link to comment https://forums.phpfreaks.com/topic/207416-eregi_replace/#findComment-1084396 Share on other sites More sharing options...
squiblo Posted July 11, 2010 Author Share Posted July 11, 2010 if I do this... $fname = "bob'"; $fname_test = eregi_replace("([A-Z']+)","",$fname); die($fname_test); The output is "\"; Link to comment https://forums.phpfreaks.com/topic/207416-eregi_replace/#findComment-1084400 Share on other sites More sharing options...
xcasio Posted July 11, 2010 Share Posted July 11, 2010 Ah, magic quotes I think.. Perhaps this? $fname = "bob\\'"; $fname = str_replace('\\\'', '\'', $fname); $fname_test = eregi_replace("([A-Z']+)","",$fname); die($fname_test); Link to comment https://forums.phpfreaks.com/topic/207416-eregi_replace/#findComment-1084406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.