robbyc Posted February 18, 2007 Share Posted February 18, 2007 I have the following regex [A-Z][a-z]{3,}[in] I simply want to remove the i or the n off the end of the matches, i.e. Russian becomes Russian and Pakistani becomes Pakistan. Thanks Quote Link to comment Share on other sites More sharing options...
Orio Posted February 18, 2007 Share Posted February 18, 2007 No regex needed... <?php $last = substr(trim($str), -1); if($last == 'n' || $last == 'i') $str = substr($str, 0, -1); ?> Orio. Quote Link to comment 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.