PHP Preg_replace() function -


how use preg_replace function replace

/c83403.403/

example: https://startimage.ca/c83403.403/ahmedmynewpix.jpg

another example: https://startimage.ca/c2.3403.403/ahmedmynewpix2.jpg

it start /c..../ want replace ""

i trying following not working $str = '/c..../'; $str = preg_replace('/+[0-9]', '', $str);

do mean this?

$str = 'https://startimage.ca/c83403.403/ahmedmynewpix.jpg'; $str = preg_replace('|/c[0-9.]+|', '', $str); echo $str; # https://startimage.ca/ahmedmynewpix.jpg' 

... or

$str = preg_replace('|/c[0-9.]+|', '/c', $str); echo $str; # https://startimage.ca/c/ahmedmynewpix.jpg' 

the point replace starting /c , containing either digits or dot symbol (.) - either empty space or /c string, depending on need. )


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -