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); Quote 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? Quote 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 "\"; Quote 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); Quote Link to comment https://forums.phpfreaks.com/topic/207416-eregi_replace/#findComment-1084406 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.