1
我想分割一個更新字符串,每次有一個時間戳時,我從飼料中獲得一個數組。正則表達式 - 在每個日期時間分割字符串
這是我到目前爲止的正則表達式,但它似乎只能找到字符串中的第一個日期時間。
^(\d{1,2}\/\d{1,2}\/\d{4})
這是我的字符串的一個例子。
$Comment = "8/13/2015 11:44:10 AMVN - Upon additional underwriting review. Account will be declined due to inconsistencies in personal and/or business information that can not be verified or validated 8/13/2015 8:32:52 AMFA Rcvd Change In Terms letter, will fwd to the Underwriter. 8/10/2015 1:21:17 PMVN - Please provide change in term letter capping monthly volume $20K, average ticket to $500 and high ticket to $1K. 8/10/2015 11:02:19 AMVN Declined as the financial condition do not support business type and requested limits. 8/10/2015 9:37:03 AMFA Rcvd Bank Statements, will fwd to the Underwriter. 8/4/2015 3:35:05 PMVN - Please provide 3 most recent bank statements and 3 most recent processing statements. 8/4/2015 9:52:04 AMBAI In Underwriting iEntry Application";
使用這個例子,我想有一個數組有七個值。
$Pattern = "^(\d{1,2}\/\d{1,2}\/\d{4})";
$Comments = preg_split($Pattern, $Comment);
你的正則表達式沒有分隔符,所以它永遠不會在PHP中運行。 – chris85