PHP and regex to convert “a” to “an” before a word starting with a vowel
RegEx to change a to an before a word starting with vowel
preg_replace('/\b(a)\s+([aeiou])/i', '$1n $2', $source_string);
For example:
" a apple" will be converted to " an apple".
" a igloo" will be converted to " an igloo".
etc. etc.








0 comments: