Skip to content

Instantly share code, notes, and snippets.

@Medalink
Created November 28, 2017 18:24
Show Gist options
  • Save Medalink/f87d3727fc0a839ba45059561e2d0619 to your computer and use it in GitHub Desktop.
Save Medalink/f87d3727fc0a839ba45059561e2d0619 to your computer and use it in GitHub Desktop.
<?php
echo '<pre>';
//ini_set('pcre.backtrack_limit', '1048');
ini_set('pcre.recursion_limit', '2097');
error_reporting(E_ALL ^ E_STRICT);
try {
$reg = preg_match_all('/[0-9-]+,"([^"]?)+/', '0,"120"1,"Global Ship Request"10,"108697687"30,"X6 HORA "33,"PM"34,"23214"35,"190"36,"16722"37,"6682"60,"50"112,"50"116,"1"119,"0"188,"^XA^CF,0,0,0^PR12^MD30^PW800^PON^CI13^LH0,20
^FO12,139^GB753,2,2^FS
^FO12,405^GB777,2,2^FS
^FO12,694^GB777,2,2^FS
^FO464,8^GB2,129,2^FS
^FO478,10^AdN,0,0^FWN^FH^FDSHIP DATE: 28NOV17^FS
^FO478,46^AdN,0,0^FWN^FH^FDCAD: 111706825/FXRS1701^FS
^FO8,151^A0N,21,21^FWN^FH^FDTO^FS
^FO37,233^A0N,38,38^FWN^FH^FDRUA DO VALOURO 1 PARQ. IND. EIRAS ^FS
^FO37,275^A0N,38,38^FWN^FH^FD^FS
^FO37,317^A0N,43,40^FWN^FH^FDCOIMBRA 3020430^FS
^FO708,320^A0N,35,45^FWN^FH^FD(PT)^FS
^FO28,747^A0N,24,24^FWN^FH^FDTRK#^FS
^FO28,805^A0N,27,32^FWN^FH^FD^FS
^FO136,717^A0N,27,36^FWN^FH^FD^FS
^FO32,10^AdN,0,0^FWN^FH^FDORIGIN ID:CMIA ^FS
^FO224,10^AdN,0,0^FWN^FH^FD21740355830000^FS
^FO32,28^AdN,0,0^FWN^FH^FDGREG JACOBS^FS
^FO32,46^AdN,0,0^FWN^FH^FDHERFF JONES,INC CAP & GOWN DIV^FS
^FO32,64^AdN,0,0^FWN^FH^FD1000 N MARKET ST^FS
^FO32,82^AdN,0,0^FWN^FH^FD^FS
^FO32,100^AdN,0,0^FWN^FH^FDCHAMPAIGN, IL 618203009 US^FS
^FO32,118^AdN,0,0^FWN^FH^FDSIGN: GREG JACOBS^FS
^FO478,100^AdN,0,0^FWN^FH^FDBILL SENDER^FS
^FO478,118^A0N,15,15^FWN^FH^FDNO EEI 30.37 (a)^FS
^FO37,149^A0N,38,38^FWN^FH^FDKEVIN KORB^FS
^FO35,359^A0N,21,21^FWN^FH^FD123.456.7890^FS
^FO37,191^A0N,38,38^FWN^FH^FDTEST COMPANY^FS
^FO677,478^GB104,10,10^FS
^FO677,488^GB10,112,10^FS
^FO771,488^GB10,112,10^FS
^FO677,600^GB104,10,10^FS
^FO652,416^A0N,43,58^FWN^FH^FDFedEx^FS
^FO708,455^A0N,19,26^FWN^FH^FDExpress^FS
^FO697,496^A0N,128,137^FWN^FH^FDE^FS
^FO785,480^A0N,13,18^FWB^FH^FDJ171016102002uv^FS
^FO21,425^BY2,2^B7N,10,5,14^FH^FWN^FH^FD[)>_1E01_1D023020430_1D620_1D01_1D4169775092130430_1DFDE_1D108697687_1D332_1D_1D1/1_1D5.00KG_1DN_1DRua do Valouro 1 Parq. Ind. Eiras _1DCoimbra_1D _1DKevin Korb_1E06_1D10ZEIO06_1D11ZTest Company_1D12Z1234567890_1D15Z111706825_1D31Z1009981724341156505600416977509213_1D32Z02_1D39ZCMIA_1D99ZEI0007_1CUS_1C0_1CUSD_1CRobes_1CNO EEI 30.37 (a)_1C0_1C_1D_1E_04^FS
^FO28,842^A0N,107,96^FWN^FH^FDX6 HORA ^FS
^FO494,890^A0N,43,43^FWN^FH^FD^FS
^FO791,120^AbN,11,7^FWB^FH^FD546C3/F877/53C1^FS
^FO95,751^A0N,53,40^FWN^FH^FD4169 7750 9213^FS
^FO409,700^A0N,51,38^FWN^FH^FB390,,,R,^FD PM^FS
^FO409,752^A0N,51,38^FWN^FH^FB390,,,R,^FD INTL PRIORITY^FS
^FO413,804^A0N,40,40^FWN^FH^FB386,,,R,^FD ^FS
^FO495,846^A0N,44,44^FWN^FH^FB298,,,R,^FD 3020430^FS
^FO574,906^A0N,24,24^FWN^FH^FB120,,,R,^FD -PT^FS
^FO695,890^A0N,43,43^FWN^FH^FB100,,,R,^FDMAD^FS
^FO39,932^A0N,27,32^FWN^FH^FD^FS
^FO75,993^BY3,2^BCN,200,N,N,N,N^FWN^FD>;1009981724341156505600416977509213^FS
^FO478,28^AdN,0,0^FWN^FH^FDACTWGT: 5.00 KG^FS
^FO328,364^AbN,11,7^FWN^FH^FDREF: TEST OPENSHIPMENT TO 555^FS
^FO38,378^AbN,11,7^FWN^FH^FDINV: ^FS
^FO38,392^AbN,11,7^FWN^FH^FDPO: ^FS
^FO428,392^AbN,11,7^FWN^FH^FDDEPT: ^FS
^FO25,768^GB58,1,1^FS
^FO25,768^GB1,26,1^FS
^FO83,768^GB1,26,1^FS
^FO25,794^GB58,1,1^FS
^FO31,774^AdN,0,0^FWN^FH^FD0430^FS
^PQ1
^XZ
^XA^CF,0,0,0^PR12^MD30^PW800^PON^CI13^LH0,20
^FO0,146^GB800,2,2^FS
^FO0,403^GB800,2,2^FS
^FO0,923^GB800,2,2^FS
^FO0,996^GB800,2,2^FS
^FO35,7^AdN,0,0^FWN^FH^FDORIGIN ID:CMIA 21740355830000^FS
^FO35,26^AdN,0,0^FWN^FH^FDGREG JACOBS^FS
^FO35,46^AdN,0,0^FWN^FH^FDHERFF JONES,INC CAP & GOWN DIV^FS
^FO35,66^AdN,0,0^FWN^FH^FD1000 N MARKET ST^FS
^FO35,87^AdN,0,0^FWN^FH^FD^FS
^FO35,107^AdN,0,0^FWN^FH^FDCHAMPAIGN, IL 618203009^FS
^FO35,127^AdN,0,0^FWN^FH^FDUNITED STATES, US^FS
^FO490,7^AdN,0,0^FWN^FH^FDShip Date: 28NOV17^FS
^FO490,46^AdN,0,0^FWN^FH^FDCAD: 111706825/FXRS1701^FS
^FO10,157^A0N,20,18^FWN^FH^FDTO^FS
^FO43,193^A0N,25,27^FWN^FH^FDTest Company^FS
^FO43,228^A0N,25,27^FWN^FH^FDRua do Valouro 1 Parq. Ind. Eiras ^FS
^FO43,263^A0N,25,27^FWN^FH^FD^FS
^FO550,305^A0N,35,45^FWN^FH^FD(PT)^FS
^FO500,413^A0N,50,55^FWN^FH^FDX6 HORA ^FS
^FO490,493^A0N,25,27^FWN^FH^FDPKG TYPE: CUSTOMER^FS
^FO35,541^AdN,0,0^FWN^FH^FDTRK#^FS
^FO360,541^AdN,0,0^FWN^FH^FDForm^FS
^FO35,618^A0N,35,35^FWN^FH^FDINTL PRIORITY^FS
^FO490,106^AdN,0,0^FWN^FH^FDBILL SENDER^FS
^FO43,158^A0N,25,27^FWN^FH^FDKevin Korb^FS
^FO615,156^AdN,0,0^FWN^FH^FD123.456.7890^FS
^FO670,268^GB105,10,10^FS
^FO670,278^GB10,112,10^FS
^FO765,278^GB10,112,10^FS
^FO670,390^GB105,10,10^FS
^FO477,0^GB2,146,2^FS
^FO650,183^A0N,50,55^FWN^FH^FDFedEx^FS
^FO715,226^AdN,0,0^FWN^FH^FDExpress^FS
^FO690,286^A0N,130,130^FWN^FH^FDE^FS
^FO575,375^A0N,20,35^FWN^FH^FDAWB^FS
^FO16,691^AdN,0,0^FWN^FH^FDDESC1:Robes^FS
^FO16,711^AdN,0,0^FWN^FH^FDDESC2:^FS
^FO16,731^AdN,0,0^FWN^FH^FDDESC3:^FS
^FO16,751^AdN,0,0^FWN^FH^FDDESC4:^FS
^FO490,465^A0N,25,35^FWN^FH^FD^FS
^FO95,543^A0N,25,27^FWN^FH^FD4169 7750 9213^FS
^FO360,561^AdN,0,0^FWN^FH^FD0430^FS
^FO30,428^BY2,3^BKN,N,100,N,N,B,D^FWN^FDB4169775092130430D^FS
^FO16,771^AdN,0,0^FWN^FH^FDEEI: NO EEI 30.37 (a)^FS
^FO16,788^A0N,15,15^FWN^FH^FDThese items are controlled by the U.S. Government and authorized^FS
^FO16,805^A0N,15,15^FWN^FH^FDfor export only to the country of ultimate destination for use^FS
^FO16,822^A0N,15,15^FWN^FH^FDby the ultimate consignee or end-user(s) herein identified. They may^FS
^FO16,839^A0N,15,15^FWN^FH^FDnot be resold, transferred, or otherwise disposed of, to any other^FS
^FO16,856^A0N,15,15^FWN^FH^FDcountry or to any person other than the authorized ultimate consignee or^FS
^FO16,873^A0N,15,15^FWN^FH^FDend-user(s), either in their original form or after being incorporated^FS
^FO16,890^A0N,15,15^FWN^FH^FDinto other items, without first obtaining approval from the U.S.^FS
^FO16,907^A0N,15,15^FWN^FH^FDgovernment or as otherwise authorized by U.S. law and regulations.^FS
^FO450,936^AdN,0,0^FWN^FH^FDSIGN: GREG JACOBS^FS
^FO16,936^AdN,0,0^FWN^FH^FDCOUNTRY MFG: US ^FS
^FO16,956^AdN,0,0^FWN^FH^FDCARRIAGE VALUE: 0.00 USD^FS
^FO16,976^AdN,0,0^FWN^FH^FDCUSTOMS VALUE: 0.00 USD^FS
^FO450,956^AdN,0,0^FWN^FH^FDT/C: S 108697687^FS
^FO450,976^AdN,0,0^FWN^FH^FDD/T: R ^FS
^FO16,1083^A0N,15,15^FWN^FH^FDThe Montreal or Warsaw Convention may apply and will govern and in most^FS
^FO16,1103^A0N,15,15^FWN^FH^FDcases limit the liability of Federal Express for loss or delay of or^FS
^FO16,1123^A0N,15,15^FWN^FH^FDdamage to your shipment. Subject to the conditions of the^FS
^FO16,1143^A0N,15,15^FWN^FH^FDcontract on the reverse.^FS
^FO783,258^A0N,15,15^FWB^FH^FDJ171016102020uv^FS
^FO15,1165^A0N,20,35^FWN^FH^FDFEDEX AWB COPY - "194,""195,"MAD"198,"HORA "409,""431,"N"498,"111706825"542,"1511890487"557,"01"558,"5149"559,"A Commercial Invoice or Proforma Invoice is required for the shipment. Please ensure the required trade document is provided before the cutoff time to aid in avoiding clearance delays."650,"TRK#"651,"0430"652,""653,"X6 HORA "654,""655,""656,"4169 7750 9213"657,""658,"PM"659,"INTL PRIORITY"660,""661,"3020430"662," -PT"663,"MAD"664,"1009981724341156505600416977509213"665,"546C3/F877/53C1"668,""669,""670,""1084,"CMIA "1086,"0"1090,"USD"1092,"H"1125,"0"1136,"X6"1274,"01"1359,"NO EEI 30.37 (a)"1393,"190"1596,""1598,"6682"2399,"0"4565,"6492"5752,"0"7700,"03"7701,"03"7702,"03"7703,"1"99,""',
$results);
} catch (Exception $e) {
print_r($reg);
print_r($e);
}
function preg_errtxt($errcode)
{
static $errtext;
if (!isset($errtxt))
{
$errtext = array();
$constants = get_defined_constants(true);
foreach ($constants['pcre'] as $c => $n) if (preg_match('/_ERROR$/', $c)) $errtext[$n] = $c;
}
return array_key_exists($errcode, $errtext)? $errtext[$errcode] : NULL;
}
var_dump(preg_errtxt(preg_last_error()));
print_r($results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment