Max Frai
Max Frai

Reputation: 64286

RegExp Pattern building

Can you help me with making pattern for PHP. Here is the string:

08-12-2010 02:24 (<a href="http://somesite.com/mail/username/3605DAC793E904E7.html" fastLink="1">link</a>)

There are a lot of such strings and I have to parse them with given date and time. I need in 3605DAC793E904E7 from that string.

$Day = date("d");
$Month = date("m");
$Year = date("Y");
$Hour = date("H");
$Minute = date("i");

$linkPattern = "/{$Day}-{$Month}-{$Year}\ {$Hour}:{$Minute}*(.*)\.html/";

But that pattern won't work. Could you help me, please?

Upvotes: 0

Views: 51

Answers (1)

aefxx
aefxx

Reputation: 25249

$reg = "/(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2}).*\/(.*)\.html/i";

Upvotes: 1

Related Questions