Created
October 5, 2016 07:12
-
-
Save bezborodow/bac574a95ab5db32503606bc35d8a2ed to your computer and use it in GitHub Desktop.
Regular Expression to Change Verb to Past Tense
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$verb = 'Suspend'; // becomes Suspended | |
$verb = 'Shape'; // becomes Shaped | |
$past = preg_replace('/(\w+?)e?\b/', '$1ed', $verb, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment