dolan2go
asked on
Exclude 3 characters in a REGEX
I am trying to exclude 'DFP' and it's adjoining time from being found by the regex. With an input string $day example:
..<omitted>...MIA 09:15<br />DEN 10:15<br />DEN 11:20<br />MIA 12:30<br />DFP 12:45.....<omitted>
(this is only an example. I haven't seen anything that would allow me to use look-ahead or behind)
$times becomes:
[0] => Array
(
[0] => MIA 09:15
[1] => DEN 10:15
[2] => DEN 11:20
[3] => MIA 12:30
[4] => DFP 12:45
)
Is the [^DFP] used somehow in here?
..<omitted>...MIA 09:15<br />DEN 10:15<br />DEN 11:20<br />MIA 12:30<br />DFP 12:45.....<omitted>
(this is only an example. I haven't seen anything that would allow me to use look-ahead or behind)
$times becomes:
[0] => Array
(
[0] => MIA 09:15
[1] => DEN 10:15
[2] => DEN 11:20
[3] => MIA 12:30
[4] => DFP 12:45
)
Is the [^DFP] used somehow in here?
preg_match_all ( '/[A-Z]{3} [0-9]{2}:[0-9]{2}/', $day, $times );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great answer. Thanks.
Thanks for the question and the points.
ASKER
David