Link to home
Start Free TrialLog in
Avatar of dolan2go
dolan2goFlag for United States of America

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?
preg_match_all ( '/[A-Z]{3} [0-9]{2}:[0-9]{2}/', $day, $times );

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dolan2go

ASKER

Good going!! That was the ticket to success. Thanks to you both.

David
Great answer. Thanks.
Thanks for the question and the points.