12 Replies Latest reply: Apr 22, 2008 3:58 AM by 800282 RSS

    regex for html

    807601
      hi!

      I have this code:
       Pattern pattern = Pattern.compile("<div class=\"center_side\">(.*)</div><!-- end center_side -->");//("<div class=\"center_side\">(.*)</div><!-- end center_side -->");//(@"<div class=""center_side""[^>]*>(.*)</div>\s*<!-- end center_side ->", 
      
                  Matcher matcher = pattern.matcher(fisier);
      
                  boolean found = false;
                  while (matcher.find()) {
                      System.out.println("I found the text "+matcher.group()+ "starting at " +
                         "index "+matcher.start()+ " and ending at index "+ matcher.end()+".%n");
                      found = true;
                  }
                  if(!found){
                      System.out.println("No match found.%n");
                  }
      it checks if a pattern like:

      <div class="center_side"> bla bla </div><!-- end center_side -->

      exists in the fiser string variable. the problem is it never works. what heva i done worng? is the regular expression good? the same expression works under c#, so i don not think that this is the problem. pls help!
        • 1. Re: regex for html
          807601
          Break the problem down.

          First try matching a small section of what you actually want to match. Make sure that works, then try matching a little more. Keep doing this until you find what is exactly causing the regex to behave differently than what you'd expect.
          • 2. Re: regex for html
            807601
            seems like that when i have in my file just <div class="center_side"></div><!-- end center_side -->, with no text in the div, the expression works. how cat i tell it to let me put text in me div if (.*) is not ok? any idea?
            • 3. Re: regex for html
              800282
              What do you mean "does not work"? Is "No match found.%n" printed?
              • 4. Re: regex for html
                800351
                it never works
                Show the example text that has failed against your regex.
                "<div class=\"center_side\">(.*)</div><!-- end center_side -->"
                should have been
                "<div class=\"center_side\">(.*?)</div><!-- end center_side -->"
                ???
                • 5. Re: regex for html
                  807601

                  (.*?) doesn't work eighter. it prints "no match found".

                  the file i wanna check is: (i want the text in red)


                  <noscript><div style='display:inline'><img src='http://ad2.ip.ro/please/showit/472/11/1/11/?typkodu=img&keywords=' width='160' height='600' style='border-width:0' alt='' /></div></noscript>
                  </div>
                  </div>
                  </div>









                  </div>
                  <!-- right~ -->


                  {color:#ff0000}<div class="center_side">
                  <div class="center">
                  <div class="rezultate">
                  <h3>Arhiva pentru data 02.04.2008</h3>{color}


                  {color:#ff0000}
                  <span class="num_result">1 - 20 din <strong>175 rezultate</strong> </span>{color}


                  {color:#ff0000} <div class="result_item">
                  1.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-international-2717494-ayman-zawahri-numarul-2-qaeda-vom-ataca-evreii-israel-afara-lui.htm%22%3E%3Cstrong%3EAyman{color}|http://www.hotnews.ro/stiri-international-2717494-ayman-zawahri-numarul-2-qaeda-vom-ataca-evreii-israel-afara-lui.htm%22%3E%3Cstrong%3EAyman]{color:#ff0000} al-Zawahri, numarul 2 in Al Qaeda: Vom ataca evreii in Israel si in afara lui</strong></a>
                  <span class="stire">Ayman al-Zawahri, numarul 2 in Al Qaeda, a declarat in cadrul unei sesiuni de raspunsuri pe internet ca organizatia sa va ataca evreii in Israel si in afara lui. al-Zawahri a deschis unul dintre site-urile afiliate Al Qaeda pentru intrebari din partea presei, termenul-limita pentru trimiterea acestora fiind 16 ianuarie.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:53
                  &icirc;n <a href="{color}[{color:#ff0000}http://www.hotnews.ro/international{color}|http://www.hotnews.ro/international]{color:#ff0000}"
                  title="Actualitate | International">Actualitate | International</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  2.<a class="result_title" href="{color}[{color:#ff0000}http://sport.hotnews.ro/stiri-fotbal-2717486-arsenal-liverpool-1-1-remiza-titanilor-video.htm%22%3E%3Cstrong%3EArsenal{color}|http://sport.hotnews.ro/stiri-fotbal-2717486-arsenal-liverpool-1-1-remiza-titanilor-video.htm%22%3E%3Cstrong%3EArsenal]{color:#ff0000} - Liverpool 1-1/ Remiza titanilor (VIDEO)</strong></a>
                  <span class="stire">Duelul britanic al sferturilor s-a incheiat la egalitate in prima mansa: Arsenal a deschis scorul prin Adebayor (23), insa Liverpool a egalat imediat prin Kuyt (26). In a doua repriza, arbitrul a refuzat un penalty lui Arsenal (interventie neregulamentara a lui Kuyt asupra lui Hleb). Spre final, atacantul londonezilor Bendtner a impiedicat o minge a coechipierilor sa intre in plasa, oprind-o pe linia portii. Fara sa vrea, fireste. </span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:53
                  &icirc;n <a href="{color[{color:#ff0000http://sport.hotnews.ro/fotbal{color}|http://sport.hotnews.ro/fotbal]{color:#ff0000}"
                  title="Sport | Fotbal">Sport | Fotbal</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  3.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2717429-liga-campionilor-fenerbahce-chelsea-2-1.htm%22%3E%3Cstrong%3ELiga{color}|http://www.hotnews.ro/stiri-ultima_ora-2717429-liga-campionilor-fenerbahce-chelsea-2-1.htm%22%3E%3Cstrong%3ELiga]{color:#ff0000} Campionilor: Fenerbahce - Chelsea 2-1</strong>
                  <span class="stire">Echipa turca Fenerbahce a furnizat surpriza sferturilor de finala, castigind cu 2-1 mansa-tur disputata contra lui Chelsea Londra. </span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:38
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  4.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-esential-2717364-update-purtatorul-cuvant-nato-nu-astept-ucraina-georgia-primeasca-map-albania-croatia-unanimitate-macedonia-probleme-din-cauza-numelui.htm%22%3E%3Cstrong%3EUPDATE{color}|http://www.hotnews.ro/stiri-esential-2717364-update-purtatorul-cuvant-nato-nu-astept-ucraina-georgia-primeasca-map-albania-croatia-unanimitate-macedonia-probleme-din-cauza-numelui.htm%22%3E%3Cstrong%3EUPDATE]{color:#ff0000}: Purtatorul de cuvant al NATO: Nu ma astept ca Ucraina si Georgia sa primeasca MAP; Albania si Croatia au unanimitate, Macedonia - probleme din cauza numelui</strong>
                  <span class="stire">Purtatorul de cuvant al NATO, James Appathurai, a declarat miercuri
                  noapte ca nu se asteapta
                  ca Ucraina si Georgia sa primeasca joi Membership Action Plan (MAP). Appathurai a mai declarat ca in cadrul NATO exista un consens privind adresarea invitatiei de aderare pentru Albania si Croatia. In ceea ce priveste Macedonia, aceasta nu beneficiaza de o sustinere unanima din cauza divergentelor cu Grecia pe tema numelui.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:36
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/esential{color}|http://www.hotnews.ro/esential]{color:#ff0000}"
                  title="Actualitate | Esential">Actualitate | Esential</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  5.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2717361-liga-campionilor-arsenal-liverpool-1-1.htm%22%3E%3Cstrong%3ELiga{color}|http://www.hotnews.ro/stiri-ultima_ora-2717361-liga-campionilor-arsenal-liverpool-1-1.htm%22%3E%3Cstrong%3ELiga]{color:#ff0000} Campionilor: Arsenal - Liverpool 1-1</strong>
                  <span class="stire">Mansa-tur a duelului britanic din sferturile Champions League s-a incheiat la egalitate: Arsenal - Liverpool 1-1.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:34
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  6.<a class="result_title" href="{color}[{color:#ff0000}http://revistapresei.hotnews.ro/stiri-radio_tv-2717210-emil-hurezeanu-romania-bulgaria-nu-fost-niciodata-verigi-strategice-pentru-rusia.htm%22%3E%3Cstrong%3EEmil{color}|http://revistapresei.hotnews.ro/stiri-radio_tv-2717210-emil-hurezeanu-romania-bulgaria-nu-fost-niciodata-verigi-strategice-pentru-rusia.htm%22%3E%3Cstrong%3EEmil]{color:#ff0000} Hurezeanu: Romania si Bulgaria nu au fost niciodata verigi strategice pentru Rusia</strong>
                  <span class="stire">Nicioadata Romania si Bulgaria nu au fost verigi strategice pentru Rusia, ca dovada sovieticii au parasit Romania ca adoua tara ocupata din rasarit, a declarat Emil Hurezeanu in cadrul emisiunii The Money Show (The Money Chanel). Hurezeanu spune ca pe romani nu-i va costa in plus suplimentarea trupelor romanesti in Afganistan deoarece avem deja acolo un contingent de rezerva ce se afla la dispozitia Secretarului General al NATO.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:20
                  &icirc;n <a href="{color[{color:#ff0000http://revistapresei.hotnews.ro/radio_tv{color}|http://revistapresei.hotnews.ro/radio_tv]{color:#ff0000}"
                  title="Revista Presei | Radio TV">Revista Presei | Radio TV</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  7.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-opinii-2717177-summitul-nato-este-deja-spectacolul-unui-singur-vladimir-putin.htm%22%3E%3Cstrong%3ESummitul{color}|http://www.hotnews.ro/stiri-opinii-2717177-summitul-nato-este-deja-spectacolul-unui-singur-vladimir-putin.htm%22%3E%3Cstrong%3ESummitul]{color:#ff0000} NATO este deja spectacolul unui singur om: Vladimir Putin</strong>
                  <span class="stire">Vladimir Putin n-a venit inca la Bucuresti, dar pare sa fi "furat" intreg spectacolul, vorba americanilor, cei care au anticipat aceasta situatie paradoxala inca de acum cateva luni. Bush, Basescu, Scheffer, analisti de politica externa, toti s-au raportat la presedintele rus si/sau i-au transmis mesaje in prima zi oficiala a evenimentului de la Bucuresti. Iar in saloanele unde au loc reuniunile oficiale, prezenta virtuala a lui Putin e aproape palpabila.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 23:04
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/opinii{color}|http://www.hotnews.ro/opinii]{color:#ff0000}"
                  title="Actualitate | Opinii">Actualitate | Opinii</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  8.<a class="result_title" href="{color}[{color:#ff0000}http://sport.hotnews.ro/stiri-fotbal-2717034-comisia-apel-grabit-judecarea-memoriului-introdus-rapid.htm%22%3E%3Cstrong%3EComisia{color}|http://sport.hotnews.ro/stiri-fotbal-2717034-comisia-apel-grabit-judecarea-memoriului-introdus-rapid.htm%22%3E%3Cstrong%3EComisia]{color:#ff0000} de Apel a grabit judecarea memoriului introdus de Rapid</strong>
                  <span class="stire">Joi, 3 aprilie, ora 14,00, comisia de apel a Federatiei romane de fotbal a convocat oficialii clubului Rapid pentru a judeca memoriul introdus impotriva deciziei de a pierde la masa verde derby-ul cu Steaua. </span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 22:03
                  &icirc;n <a href="{color[{color:#ff0000http://sport.hotnews.ro/fotbal{color}|http://sport.hotnews.ro/fotbal]{color:#ff0000}"
                  title="Sport | Fotbal">Sport | Fotbal</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  9.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2716610-canal-lansat-nato.htm%22%3E%3Cstrong%3ECanal{color}|http://www.hotnews.ro/stiri-ultima_ora-2716610-canal-lansat-nato.htm%22%3E%3Cstrong%3ECanal]{color:#ff0000} TV lansat de NATO</strong>
                  <span class="stire">Secretarul general al NATO, Jaap de Hoop Scheffer, impreuna cu
                  premierul danez, Anders Fogh Rasmussen, au lansat un canal de
                  televiziune pe Internet care va transmite pe toata perioada summitului.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 21:37
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  10.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-international-2716487-rusia-elaborat-plan-actiuni-cazul-care-ucraina-primeste-invitatia-adera-nato.htm%22%3E%3Cstrong%3ERusia{color}|http://www.hotnews.ro/stiri-international-2716487-rusia-elaborat-plan-actiuni-cazul-care-ucraina-primeste-invitatia-adera-nato.htm%22%3E%3Cstrong%3ERusia]{color:#ff0000} a elaborat un plan de actiuni in cazul in care Ucraina primeste invitatia de a adera la NATO</strong>
                  <span class="stire">Un inalt diplomat rus a declarat ca Moscova a elaborat planuri in cazul
                  in care Georgia si Ucraina vor primi invitatia sa adere la Planul de
                  actiuni al NATO (MAP), dar a refuzat sa dezvaluie continutul acestor
                  planuri, scrie agentia Utro.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 20:44
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/international{color}|http://www.hotnews.ro/international]{color:#ff0000}"
                  title="Actualitate | International">Actualitate | International</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  11.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-international-2716469-bush-intalni-soci-medvedev.htm%22%3E%3Cstrong%3EBush{color}|http://www.hotnews.ro/stiri-international-2716469-bush-intalni-soci-medvedev.htm%22%3E%3Cstrong%3EBush]{color:#ff0000} se va intalni la Soci cu Medvedev</strong>
                  <span class="stire">Presedintele SUA, George Bush, care va sosi la Soci pentru intalnirea
                  cu din 6 aprilie cu seful statului rus, Vladimir Putin, se va intalni,
                  de asemenea, cu presedintele ales al Rusiei, Dmitri Medvedev, a anuntat
                  consilierul presidential al Rusiei, Serghei Prihodko, citat de Gazeta.ru.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 20:42
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/international{color}|http://www.hotnews.ro/international]{color:#ff0000}"
                  title="Actualitate | International">Actualitate | International</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  12.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2716466-arad-circulatie-rutiera-blocata-sens-dn7.htm%22%3E%3Cstrong%3EArad{color}|http://www.hotnews.ro/stiri-ultima_ora-2716466-arad-circulatie-rutiera-blocata-sens-dn7.htm%22%3E%3Cstrong%3EArad]{color:#ff0000}: Circulatie rutiera blocata pe un sens pe DN7</strong>
                  <span class="stire">Circulatia rutiera este blocata pe un sens la aceasta ora pe DN7, in
                  zona localitatii aradene Lipova, din cauza unui accident de circulatie.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 20:41
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  13.<a class="result_title" href="{color}[{color:#ff0000}http://english.hotnews.ro/stiri-business-2716416-usa-federal-reserve-president-ben-bernake-admit-the-peril-economic-recession.htm%22%3E%3Cstrong%3EUSA{color}|http://english.hotnews.ro/stiri-business-2716416-usa-federal-reserve-president-ben-bernake-admit-the-peril-economic-recession.htm%22%3E%3Cstrong%3EUSA]{color:#ff0000}: Federal Reserve President Ben Bernake to admit the peril of an economic recession</strong>
                  <span class="stire">President of the American Central Bank (FED) Ben Bernanke admitted on Wednesday that the US economy might enter into recession in the first half of the year, admitting that the situation got worse in the last couple of months.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 20:31
                  &icirc;n <a href="{color[{color:#ff0000http://english.hotnews.ro/business{color}|http://english.hotnews.ro/business]{color:#ff0000}"
                  title="English | Business">English | Business</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  14.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2716310-opt-delegatii-oficiale-sunt-cazate-hotel-hilton.htm%22%3E%3Cstrong%3EOpt{color}|http://www.hotnews.ro/stiri-ultima_ora-2716310-opt-delegatii-oficiale-sunt-cazate-hotel-hilton.htm%22%3E%3Cstrong%3EOpt]{color:#ff0000} delegatii oficiale sunt cazate la Hotel Hilton</strong>
                  <span class="stire">Delegatiile Germaniei, Georgiei, Poloniei, Canadei, Olandei, Estoniei,
                  Lituaniei si Azerbaidjanului sunt gazduite la Hotel Hilton, pe durata
                  summitului NATO.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 20:06
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  15.<a class="result_title" href="{color}[{color:#ff0000}http://economie.hotnews.ro/stiri-finante_banci-2716226-sua-ben-bernanke-seful-fed-admite-premiera-pericolul-recesiunii-economice.htm%22%3E%3Cstrong%3ESUA{color}|http://economie.hotnews.ro/stiri-finante_banci-2716226-sua-ben-bernanke-seful-fed-admite-premiera-pericolul-recesiunii-economice.htm%22%3E%3Cstrong%3ESUA]{color:#ff0000}: Ben Bernanke, seful FED, admite in premiera pericolul recesiunii economice</strong>
                  <span class="stire">Ben Bernanke, presedintele Bancii Centrale Americane - Federal Reserve,
                  a admis miercuri, in premiera, ca economia SUA ar putea intra in
                  recesiune in prima jumatate a anului, admitand inrautatirea situatiei
                  din ultimele doua luni. Bursa din New York a reactionat insa mai putin
                  dur decat s-au asteptat analistii pietelor financiare, socul
                  declaratiilor lui Bernanke fiind atenuat, cel putin la deschiderea
                  sedintei, de un raport care arata ca numarul locurilor de munca in
                  sectorul privat a crescut in martie cu 8.000.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 19:51
                  &icirc;n <a href="{color[{color:#ff0000http://economie.hotnews.ro/finante_banci{color}|http://economie.hotnews.ro/finante_banci]{color:#ff0000}"
                  title="Economie | Finante & Banci">Economie | Finante & Banci</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  16.<a class="result_title" href="{color}[{color:#ff0000}http://life.hotnews.ro/stiri-horoscop-2716055-horoscopul-pentru-joi-3-aprilie.htm%22%3E%3Cstrong%3EHoroscopul{color}|http://life.hotnews.ro/stiri-horoscop-2716055-horoscopul-pentru-joi-3-aprilie.htm%22%3E%3Cstrong%3EHoroscopul]{color:#ff0000} pentru joi, 3 aprilie</strong>
                  <span class="stire">BERBECSefii ori partenerii va cam ocolesc si comportamentul lor nu va convine deloc, deoarece presupune schimbari pentru care nu vi se cere parerea. Visati la o marire de "salariu", cu toate ca nu este posibil.Sanatate &ndash; ?Bani &ndash;??Dragoste &ndash;???</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 19:12
                  &icirc;n <a href="{color[{color:#ff0000http://life.hotnews.ro/horoscop{color}|http://life.hotnews.ro/horoscop]{color:#ff0000}"
                  title="Life | Horoscop">Life | Horoscop</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  17.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-ultima_ora-2716049-urmatorul-atentat-din-sua-putea-comis-teroristi-blonzi-ochi-albastri.htm%22%3E%3Cstrong%3EUrmatorul{color}|http://www.hotnews.ro/stiri-ultima_ora-2716049-urmatorul-atentat-din-sua-putea-comis-teroristi-blonzi-ochi-albastri.htm%22%3E%3Cstrong%3EUrmatorul]{color:#ff0000} atentat din SUA ar putea fi comis de teroristi blonzi cu ochi
                  albastri</strong>
                  <span class="stire">Urmatorul atentat din Statele Unite ar putea fi comis de teroristi
                  blonzi cu ochi albastri, antrenati in tabere din zona dintre Pakistan
                  si Afganistan, comenteaza Reuters.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 19:10
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/ultima_ora{color}|http://www.hotnews.ro/ultima_ora]{color:#ff0000}"
                  title="Ultima ora">Ultima ora</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  18.<a class="result_title" href="{color}[{color:#ff0000}http://life.hotnews.ro/stiri-natural-2716017-exercitiile-tai-chi-ajuta-tratarea-diabetului-tip-2.htm%22%3E%3Cstrong%3EExercitiile{color}|http://life.hotnews.ro/stiri-natural-2716017-exercitiile-tai-chi-ajuta-tratarea-diabetului-tip-2.htm%22%3E%3Cstrong%3EExercitiile]{color:#ff0000} Tai Chi ajuta la tratarea diabetului de tip 2</strong>
                  <span class="stire">12 saptamani de exercitii Tai Chi au fost suficiente pentru a pune pe
                  picioare sistemul imunitar al pacientilor, precum si pentru a le
                  normaliza nivelul glicemiei, au constatat doua studii separate.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 19:05
                  &icirc;n <a href="{color[{color:#ff0000http://life.hotnews.ro/natural{color}|http://life.hotnews.ro/natural]{color:#ff0000}"
                  title="Life | Natural">Life | Natural</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  19.<a class="result_title" href="{color}[{color:#ff0000}http://economie.hotnews.ro/stiri-burse-2715830-bvb-propune-modificarea-conditiilor-listare-mentinere-companiilor-bursa.htm%22%3E%3Cstrong%3EBVB{color}|http://economie.hotnews.ro/stiri-burse-2715830-bvb-propune-modificarea-conditiilor-listare-mentinere-companiilor-bursa.htm%22%3E%3Cstrong%3EBVB]{color:#ff0000} propune modificarea conditiilor de listare si de mentinere a companiilor la bursa</strong>
                  <span class="stire">Bursa de Valori Bucuresti (BVB) va avea consultari cu principalii
                  actori ai pietei de capital cu privire la o noua modificare a Codului
                  Bursei. Potrivit unui comunicat al institutiei, propunerile de
                  modificare a Codului Bursei se refera la conditiilor pentru listarea si
                  mentinerea companiilor la prima si a doua categorie a BVB.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 18:47
                  &icirc;n <a href="{color[{color:#ff0000http://economie.hotnews.ro/burse{color}|http://economie.hotnews.ro/burse]{color:#ff0000}"
                  title="Economie | Burse">Economie | Burse</a>
                  </span>
                  </div>
                  </div>
                  <div class="result_item">
                  20.<a class="result_title" href="{color}[{color:#ff0000}http://www.hotnews.ro/stiri-opinii-2715543-liniste-summit-afara-anarhistii.htm%22%3E%3Cstrong%3ELiniste{color}|http://www.hotnews.ro/stiri-opinii-2715543-liniste-summit-afara-anarhistii.htm%22%3E%3Cstrong%3ELiniste]{color:#ff0000}, e summit. Afara cu anarhistii !</strong>
                  <span class="stire">Esti anti-NATO? Anarhist te numesti. Vrei sa fie desfiintata Alianta si sa protestezi impotriva ei? Pofta-n cui ca ajungi la zdup, te salta mascatii si te duc la sectie. Ai la tine afise, vopsea, inscrisuri, bannere, carioca, spayuri? Ai incalcat legea. Porti un tricou inscriptionat cu anti? Esti suspect. Nimic nu trebuie sa strice linistea fortaretei in care se desfasoara summitul. Politia romana a fost lovita in plina figura mascata de fobia anarhismului. Protestatari, go home, Bucurestiul e de necucerit, chiar si de pe frontul de la Timpuri Noi. Liniste, e summit! Doar zelosenia ii poate veni de hac.</span>
                  <div class="actualitate_footer align_text">
                  <span>Miercuri, 2 aprilie 2008, 18:21
                  &icirc;n <a href="{color[{color:#ff0000http://www.hotnews.ro/opinii{color}|http://www.hotnews.ro/opinii]{color:#ff0000}"
                  title="Actualitate | Opinii">Actualitate | Opinii</a>
                  </span>
                  </div>
                  </div>

                  <div class="paginare"><a href='http://www.hotnews.ro/arhiva/2008-04-02/1'><b>1</b></a> <a href='http://www.hotnews.ro/arhiva/2008-04-02/2'>2</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/3'>3</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/4'>4</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/5'>5</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/6'>6</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/7'>7</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/8'>8</a>&nbsp<a href='http://www.hotnews.ro/arhiva/2008-04-02/9'>9</a>&nbsp</div>
                  </div>{color}


                  {color:#ff0000} </div><!-- end center -->
                  </div><!-- end center_side -->
                  {color} <br/>
                  <div id="footer">
                  <div class="footerMenu">
                  <div class="footerMenuLeft">
                  <ul>
                  <li class="josActualitate">
                  <a href="[http://www.hotnews.ro/%22%3Eactualitate%3C/a]>
                  </li>
                  <li class="josEconomie">
                  </li>
                  <li class="josLife">

                  • 6. Re: regex for html
                    807601
                    it seems it doesn't work because of the enter (crlf) caracters from the file. how can i add them in the expression?
                    • 7. Re: regex for html
                      800282
                      naicul wrote:
                      it seems it doesn't work because of the enter (crlf) caracters from the file. how can i add them in the expression?
                      Try adding *(?m)* at the start of your regex (that's the multiline flag). I also recommend your to use the reluctant (.*?) instead of the greedy (.*).
                      • 8. Re: regex for html
                        807601
                        (?m)<div class=\"center_side\">(.*?)</div><!-- end center_side -->" - doesn't work

                        <div class=\"center_side\">(?m)(.*?)</div><!-- end center_side -->" -doesn't work either
                        • 9. Re: regex for html
                          807601
                          seems like

                          \s Matches any single whitespace character, mainly space, tab, and newline (`r and `n). Conversely, capital \S means "any non-whitespace character".

                          but i don't know where to put it in my expression... :(
                          • 10. Re: regex for html
                            807601
                            this one works:
                            Pattern pattern = Pattern.compile("<div class=\"center_side\">(.*?)</div><!-- end center_side -->", Pattern.MULTILINE | Pattern.DOTALL);
                            • 11. Re: regex for html
                              800351
                              naicul wrote:
                              this one works:
                              Pattern pattern = Pattern.compile("<div class=\"center_side\">(.*?)</div><!-- end center_side -->", Pattern.MULTILINE | Pattern.DOTALL);
                              Yes, you should have had used (?s), not (?m).
                              (?s) == DOTALL
                              • 12. Re: regex for html
                                800282
                                hiwa wrote:
                                ...
                                Yes, you should have had used (?s), not (?m).
                                (?s) == DOTALL
                                Ah, yes, of course.