我有一個變量包含多個日期格式(01AUG)可能是任何其他日期。正則表達式php(正則表達式)
現在我需要使用上面給出的日期格式來分割變量。這個變量包含多個這樣的格式與不同的日期。請告訴我如何我可以通過使用php日期分割這個字符串。我認爲正則表達式只是我們可以解決這個問題。
$var= '01AUG 14:35:27 4026208273880857 521314795212 795212 400088 0200 010000 901 02 14 5,000.00 NPR 0.00 CA ID: 0178SBLN 1001013 22/Kakarvitta /NP 0000 FPI: 886 DG CD: NA ACI: N FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM DECLINE 0.300000CR 04 01AUG 11:42:01 4117733926341924 521311789579 789579 411773 0200 012000 901 02 00 10,400.00 NPR 101.79CR CA ID: 0182SBLN 1001010 25/Lazimpat /NP 0000 FPI: 885 TR ID: 465213429879918 ACI: E SCHG: 400.00 FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -U.S.A. FEE LEVEL: ATM-TIER II AF 0.646805CR 37 02AUG 03:48:19 4539796662883201 521403809409 809409 400088 0200 010000 901 02 05 6,000.00 NPR 0.00 CA ID: 0471SBLN 1001010 25/Thamel Lounge /NP 0000 FPI: 886 DG CD: NA ACI: N FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM DECLINE 0.300000CR 07 01AUG 12:52:12 4547030014539661 521312792592 792592 400088 0200 013000 901 02 57 25,000.00 NPR 0.00 CA ID: 0173SBLN 1001028 25/Boudha /NP 0000 FPI: 886 DG CD: NA ACI: N FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM DECLINE 0.300000CR 07 01AUG 12:57:37 4571652018388487 521312792812 792812 400088 0200 012000 901 02 00 25,000.00 NPR 244.68CR CA ID: 0173SBLN 1001028 25/Boudha /NP 0000 FPI: 886 TR ID: 385213475230796 ACI: E VC: P6RC FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM-TIER II 1.500000CR 08 01AUG 13:20:50 4580030725494543 521313793593 793593 400088 0200 010000 901 02 00 10,000.00 NPR 97.87CR CA ID: 0471SBLN 1001010 25/Thamel Lounge /NP 0000 FPI: 886 TR ID: 305213489171412 ACI: E VC: V7QR FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM-TIER II 1.500000CR 46 02AUG 08:37:38 4595000092328247 521408828378 828378 400088 0200 012000 901 02 00 1,000.00 NPR 9.79CR CA ID: 0171SBLN 1001010 25/Roadhouse Thamel /NP 0000 FPI: 886 TR ID: 385214319247297 ACI: E VC: ZC5V FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM-TIER II 1.500000CR 07 01AUG 12:50:09 4599228000108437 521312792507 792507 400088 0200 012000 901 02 00 10,000.00 NPR 97.87CR CA ID: 0471SBLN 1001010 25/Thamel Lounge /NP 0000 FPI: 886 TR ID: 585213470757658 ACI: E VC: 2V7Z FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM-TIER II 1.500000CR 05 01AUG 12:10:26 4751170038590711 521312790835 790835 400088 0200 010000 901 02 05 6,000.00 NPR 0.00 CA ID: 0300SBLN 1001043 25/Baniyatar /NP 0000 FPI: 886 DG CD: NA ACI: N FEE JURIS: VISA INTERNATIONAL ROUTING: 1 A.P. -E.U. FEE LEVEL: ATM DECLINE 0.300000CR';
我一直在使用這種模式
preg_match_all('/.+?\s*(?=\b\d{2}[A-Z]{3}\b\s|$)/', $var, $match);
echo '<pre>';
print_r($match[0]);
echo '</pre>';
請幫我this.Thanks用於使preg_split在您的幫助
這就是爲什麼我們有preg_match_all .'preg_match_all( '/ \ B(\ d \ d)(AZ){3} \ B /',$ V,$匹配); ' –
您的預期產出是什麼? – anubhava
謝謝Avinash Raj。但我試過這個,但它給陣列內數組爲什麼這是請嘗試在你身邊,並返回給我,如果你能抓取結果 –