Tuesday, 15 September 2015

php - Regular Expression to determine if a char is prefixed by number -



php - Regular Expression to determine if a char is prefixed by number -

i have text link

yeast-aid™ 200c - hypoallergenic

i want replace "200c" "200 caps" done on 20k records want , look able replace "c" prefixed number " caps".

i utilize php.

this basic regex substitution. seek programme out:

<?php $string = 'yeasties 200c - hyperhyperhyper'; echo preg_replace('/(\d)c/i', '$1 caps', $string); echo "\n"; ?>

preg_replace preforms regex substitution.

if cannot figure out how programme works, or want reference, seek php documentation here, preg_replace.

you should online documentation first. have never used php before (literally first programme it), didn't find challenging. perhaps of import coding skill beingness able larn things quickly.

php regex

No comments:

Post a Comment