Reputation: 2980
I have filenames in this format:
SCANNERID_00001SCAN_28-11-2013_email_X_gmail.com_LEFT.zip
another example
SCANNERID_99999SCAN_33-03-2015_mymail_X_hotmail.com_RIGHT.zip
the @
sign has been replaced with an _X_
. The side (at the end of the filename, in this case LEFT
) is variable; either LEFT
or RIGHT
.
the date is obviously variable and is not necessarily the current date.
I want to extract [email protected]
or [email protected]
using regexp in PHP.
Upvotes: 0
Views: 62
Reputation: 3328
preg_replace("/SCANNERID_.+_\d{1,2}-\d{1,2}-\d{1,4}_(.+)_X_(.+)_(LEFT|RIGHT).zip/", "$1@$2", $input_lines);
Upvotes: 3