I need to remove (Year-Month-Day) from a string without knowing the values of (year-month-day). so what do i do to tell it that those are unknown values.
Can I see an example of the string? If formatted correctly and at the front of a string an easy way is: In this format: xxxx-xx-xx = 10 characters. $string = substr( $string, 11); So: $string = "2007-01-23 Filler Text"; $string = substr( $string, 11); The Variable string would now be: " Filler Text". That is just one method. There are others such as picking up on formated wild cards, exploding/imploding the data array. -Jim
This method will work where ever the date is: $regex = "/[0-9]{4}-[0-9]{2}-[0-9]{2}/"; $string = "A date 1975-05-14 is in here somewhere..."; $new_string = ""; $new_string = preg_replace( $regex, '', $string ); echo $string . "<br /><br />"; echo $new_string; PHP: Brew