Perl (preg) Regular Expression
Posted on 2004-10-11
Need to match anythign like the following:
Firstname Lastname [Y] (sdsdd 45)
Firstname Lastname (sdsdd 45)
Firstname Lastname [R] (sdsdd 45)
Firstname Lastname [Y][R] (sdsdd 45)
This is for my football site I am trying to develop were [Y] and [R] are yellow and
red cards respectively. Anything brackets reprsents a substitution.
I have the following that only partially works:
$pattern = '/'.$player.' \((.*?)\)/mis';
This matches all players that have not been given a card but have been substituted. This however won't work:
$pattern = '/'.$player.' (\[Y|R\])* \((.*?)\)/mis';
It is meant to detect players that may or may not have been given a card but have been substituted.
Any ideas gratefully recieved.