php - Removing word + wildcard number from string -
i have string is
$str = "testingsub1"; how can strip out sub* string? assume using preg_replace i'm not matching want regex.
does know how can this?
thank you
that's way.
$str = preg_replace("#sub[0-9]+#", "", $str); the #s delimiters; can non-alphanumeric/whitespace/backslash character doesn't appear in pattern. [0-9] means digit (you can use \d in languages, don't bother), , + means 1 or more of previous, if take + out replace first digit
Comments
Post a Comment