Hi!
I'm totally new to Regex so I apologize if this question may sound ridiculous.
I've got the following string which I want to analyze:
"r099c33"
Now I want all digits between r and c.
Can you tell me which pattern would fit best to this task pls?
Thanks.
enne
problem with pattern
Moderator: General Moderators
Re: problem with pattern
Possible solution:
Code: Select all
$str = "r099c33";
$str = preg_replace("/r(.*)c(.*)/", "\\1", $str);
echo $str;Re: problem with pattern
Perfect, thx corvin.
Re: problem with pattern
Code: Select all
substr('r099c33', 1, 3);If you have got a list of codes like below, my substr() will do just fine and regex is overkill.
a789s33
d850k89
z123d8
e058d971