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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -