I have a string that contains a lot of information, including a total count and current count. I want to use regex and php to match either [001/100]
or (001/100)
.
- It can either be wrapped in parentheses or brackets.
- It may also contain spaces inside the parentheses or brackets
( 001/100)
. - The delimiter can also be a
:
or|
.
I want to ignore all spaces within the parentheses or brackets and the numbers can be any digets.
I plan to use preg_match_all. I am just struggling to figure out the regex.
preg_match_all('/[\(\[](\d+)[\:\|](\d+)[\)\]]/' $tmp, $matches);