Expressão regular que não corresponde a todas as possibilidades

0

Estou tendo um pequeno problema com uma expressão regular ... Estou tentando analisar um arquivo HTML procurando por determinado texto entre dois <br> tags ... entre esses <br> (o texto vai aqui) <br> tags existem sempre 3 tipos diferentes de texto que estarão lá ...

Type 1)<br>S987 *BREKER BRD AUDIO-10 WX/R RADAR BOX,MAN,AC 24.95 GOOD<br>

O tipo 1 SEMPRE começará com um caractere ALPHABETICAL seguido por EXATAMENTE 3 dígitos e, em seguida, seguido por todos os tipos de caracteres diferentes, como você pode ver ..

Type 2)<br>==== ========== =============== ======= ====================<br>

O tipo 2 é sempre um monte de "=" sinais e espaços ...

Type 3)<br>Is normal text and may sometimes contain "=" signs<br>

Agora, meu problema é este ... somente a primeira instância do Tipo 1 é retornada, embora haja centenas dessas linhas ... também ... Eu não quero apenas as correspondências Tipo 2 ou Tipo 3 ... Digite 1s entre as tags <br> ...

Atualmente, estou usando o seguinte:

/<br>([A-Z]{1}\d{3}.*?)<br>/

Isto é para php ...

Obrigado

Danny

    
por Danny 06.12.2015 / 15:27

1 resposta

0
<your_enormous_example \
sed -netP -e's/<br>[[:alpha:]][0-9]\{3\}[^<]*<br>/\n&\n/;D;:P' -eP\;D
<br>D163 *ALERT WRK EAR-10          EMERGENCY WEATHER RADIO        BOX,MAN,AC PS          24.95 GOOD<br>
<br>D147 *AMERITRON AWM35           FLAT SWR/WATT METER            BOX,MAN               124.95 GOOD       S/N 013029<br>
<br>D113 *AOR       AR-DV1B         RCVR .10-1300MHZ BLOCKED       BOX,MAN,ANT,PS        959.95 GOOD       S/N 09560012<br>
<br>D152 *ASTRON    SL11A           PS 13V - 9 AMP                 BOX,MAN                69.95 GOOD<br>
<br>D118 *BEARCAT   BCD-396XT       DIGITAL TRUNKING HH SCANNER    BOX,MAN,ACCYS         299.95 GOOD       S/N 359Z48002616<br>
<br>D126 *COMET     RS720           REAR LIP MOUNT NO COAX         MAN,BOX                19.95 GOOD<br>
<br>D300 *CRANE     WITNESS PLUS    AM/FM RADIO WITH MP3           BOX,MAN               132.95 GOOD       S/N 20701418<br>
<br>D110 *DEGEN     DE  15          RCVR MW/SW/FM                  BOX,MAN,BATTS,CASE     31.95 GOOD       S/N FB026781<br>
<br>D142 *DEGEN     DE1126          DIGITAL AM/FM/SW/MP3           BOX,MAN                58.95 GOOD       S/N GC036267<br>
<br>D307 *ETON      FR 600 BLK      AM/FM/WX/SW                    BOX,MAN                55.95 GOOD       SMALL CRACK DISPLAY<br>
<br>D162 *ETON      SATELLIT        AM/FM/SW                       BOX,MAN               159.95 GOOD       S/N 4B00088112S<br>
<br>D166 *ETON      SCORP ORG       EMERGENCY AM/FM/WX ORANGE      BOX,MAN                37.95 GOOD       S/N 100NOR001987<br>
<br>D159 *HEIL      CC1-KM          MIC CABLE KENW  MODL RED       NONE                   28.95 GOOD<br>
<br>D104 *ICOM      MBF1            SUCTION MOUNT                  BOX                    54.95 GOOD<br>
<br>D140 *ICOM      PS126           PS                             BOX,MAN               379.95 GOOD<br>
<br>D146 *ICOM      R  75           RCVR COMM GC DIG 0.3-60MHZ     COUPON ELIGIBLE-BOX   619.95 GOOD       S/N 2203411<br>
<br>D155 *ICOM      SM 50           DESK MIC 7600                  NONE                  239.95 GOOD       S/N 02070171<br>
<br>D149 *SANGEAN   DT-200X         AM/FM POCKET RADIO             BOX,MAN,EARBUDS        37.95 GOOD       S/N 29011218<br>
<br>D145 *SANGEAN   PT- 50          PORT DIG RCVR                  BOX,MAN                49.95 GOOD       S/N 3C018394<br>
<br>D184 *SANGEAN   RCR 8WF         FM/WI-FI CLOCK RADIO           BOX,MAN               139.95 GOOD       S/N 0903000789<br>
<br>D109 *SANGEAN   WR 2WH WHT      AM/FM DIGITAL TABLE WHITE      BOX,MAN,ACCS          104.95 GOOD       S/N 0604000196<br>
<br>D170 *SONY      ICF-SW7600GR    RCVR PORT DIG LW/MW/FM/SW      BOX,MAN,ANT 60        139.95 GOOD       S/N 306100<br>
<br>D143 *VECTRONIC PM30UV B        SWR 30/300W 100-500 BNC        BOX,MAN                62.95 GOOD<br>
<br>D153 *YAESU     FT 277R         HT 440    5W                   BOX,MAN,ANT,CHRGR     109.95 GOOD       S/N 2L500093<br>
<br>D114 *YAESU     FT 277R         HT 440    5W                   BOX,MAN               109.95 GOOD       S/N 21500091<br>
<br>W631 BELL&HOWEL 9 BAND RADIO    FM/MW/SW PORTABLE RADIO        MAN,BOX,EAR BUDS       10.95 GOOD       S/N A9029589<br>
<br>W301 EVEREX     GP41D           PORT. COLOR CAMERA(HITACHI)    BOX,AP4U AC ADAPTOR    49.95 GOOD       S/N 3036899<br>
<br>W920 MFJ         1278           MULTIMODE DATA CONTROLLER      FINAL SALE             51.95 AS IS      NOT TESTED/AS IS<br>
<br>Y004 PACCOMM    TNC 220         DUAL MODEM PACKET CONTROLLER   MANUAL                 44.95 GOOD<br>
<br>U424 TORRESTRON HC-1            CHARGE ADPT. ICOM              MAN.                    3.95 GOOD<br>
<br>B103 _USED BOOK BY AMECO        AMATEUR RADIO THEORY COURSE                           10.95 GOOD       1976 EDITION<br>
<br>B105 _USED BOOK BY ARRL         HANDBOOK 2014                                         29.95 GOOD<br>
<br>B072 _USED BOOK BY DARC         RADIO AMATEURS WORLD ATLAS     1993 EDITION           19.95 GOOD<br>
<br>B277 _USED BOOK BY HEATHKIT     GENERAL LICENSE CONTINUING ED  2 VOLUMES              19.95 GOOD<br>
<br>B113 _USED BOOK BY IBS          PASSPORT 1996                                          9.95 GOOD<br>
<br>B071 _USED BOOK BY IBS          PASSPORT 2003                  NONE                    9.95 GOOD<br>
<br>B169 _USED BOOK BY IOTA         "IOTA DIRECTORY"                                       4.00 GOOD<br>
<br>B171 _USED BOOK BY IOTA         "IOTA DIRECTORY"                                       4.00 GOOD<br>
<br>B084 _USED BOOK BY MCCULLY      POCKET REF VX-7R                                      10.00 GOOD<br>
<br>B078 _USED BOOK BY NATIONAL NC  "INSTR MAN NATIONAL NC-173"                           19.95 GOOD<br>
<br>B014 _USED BOOK BY WRTH         "1995 WRTH"                                            9.95 GOOD<br>
<br>B067 _USED BOOK BY WRTH         "WRTH 1991 EDITION"                                    9.95 GOOD<br>
<br>B065 _USED BOOK BY WRTH         "WRTH 1995 EDITION"                                    9.95 GOOD<br>
<br>B254 _USED BOOK BY WRTH         WRTH 1996                                              6.95 GOOD<br>
<br>B108 _USED BOOK BY WRTH         WRTH- 4 BOOKS 1995,96,97,98                           34.95 GOOD<br>
    
por 07.12.2015 / 16:20