4
I’m looking to "filter" the string
to obtain only the date that is on it, the string
is in that format:
SSC Napoli v Dnipro - Thursday 07/05/2015 16:05 Hours
The I want to take is just the 07/05/2015 16:05
, used the explode
:
$datas = eregi_replace('[.\A-Z\-]','', $datas);
$datas = explode("/",trim($datas));
$dia = substr($datas["0"], -2);
$datas = $dia."/".$datas["1"]."/".$datas["2"]."";
return $datas;
But the problem is that when the name of the team that is in the string has number, like:
SSC Napoli2 v Dnipro - Thursday 07/05/2015 16:05 Hours
Obviously it will go wrong, wanted to wear something in regex
if I could, to extract this date and time, I am weak in regex
and I’ve tried some things but it didn’t work!
Updating:
I was able to make it work also using the following algorithm:
eregi_replace('[.\A-Z\-]','',substr($_GET["link"],-22));
But if anyone has anything more elaborate, please respond!
Killed the stick!!! thanks! needed to search the year in a text field
– user51882