Regex and matcher only returns the first match

Hi all.
Im trying to rewrite some code and im using a regular expression to grab data out of a css formatted file, but im getting a bit confused. My matcher is only finding the first occurance of my pattern, how do i get it to find all occurances of my pattern?
here is a sample css file
.header
font-family:arial, verdana;
font-weight:bold;
color:#ff00ff;
background-image:url(background.jpg);
.mainBody
font-weight: bold;
color: Red;
padding 0px;
}and here is my matcher code
tstr = tstr.replaceAll("\\\\","/");
tstr = tstr.replaceAll("\\n","");
tstr = tstr.replaceAll("\\r","");
Pattern styleFind=Pattern.compile("^\\.?[\\w\\s\\W]+?\\{.*?\\}",Pattern.DOTALL | Pattern.MULTILINE);
Matcher styleMatch=styleFind.matcher(tstr);
while(styleMatch.find())
System.out.println("[A]"+styleMatch.group());
}     i thought that if i did while(macther.find) then it would keep looping through finding all of the matches, but it is only finding the first match.
any ideas what im doing wrong?

tstr = tstr.replaceAll("\\\\","/");
tstr = tstr.replaceAll("\\n","");
tstr = tstr.replaceAll("\\r","");
Pattern
styleFind=Pattern.compile("^\\.?[\\w\\s\\W]+?\\{.*?\\}", Pattern.DOTALL | Pattern.MULTILINE);
Matcher styleMatch=styleFind.matcher(tstr); You do MULTILINE despite the fact that you delete all end of line characters first. The '^' matches only at the very beginning of the input.
Apart from that I would prefer "[^\\}]" anytime ofer ".*?\\}", because what you want is a shortest match which often turns out not to be the same as a non-greedy match.
Harald.
Java Text Crunching: http://www.ebi.ac.uk/Rebholz-srv/whatizit/software

Similar Messages

  • TS1717 I just downloaded a song and it only plays the first 50 seconds and then moves to the next song in the list. How can I get it to play the rest of the song?

    I just downloaded a song and it only plays the first 50 seconds and then moves to the next song in the list. How can I get it to play the rest of the song?

    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copy of the track and try redownloading a fresh one. See the following document for instructions:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    Otherwise, I'd report the problem to the iTunes Store.
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the item, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.

  • I purchased a season of downtown abbey and it only downloaded the first 30 seconds of every episode.  How do,I co

    I Purchased a season of downton abbey from iTunes on my iPad and it only downloaded the first 30 seconds of every episode..how do I correct this?

    You are trying to watch them in the Videos app and not the previews in the iTunes store app ? If you are then depending upon what country that you are in (TV programmes can't be re-downloaded in all countries) then try deleting those episodes from the Videos app on your iPad and then redownload them via the Purchased tab in the iTunes store app.
    If you aren't in a country where you can re-download TV programmes or if they re-download in the same state then try the 'report a problem' link from your purchase history : log into your account on your computer's iTunes via the Store > View Account menu option and you should then see a Purchase History section with a 'see all' link to the right of it ; click on that and you should see a list of your purchases ; find that series and use the 'Report a Problem' link and fill in details about the problem (iTunes support should reply within, I think, about 24 hours).
    If the 'report a problem' link doesn't work (it's been taking some people to this site on a browser instead of showing a form in iTunes) then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page.

  • I bought the second season of arrow on i tunes and it only downloaded the first episode how do i download the rest?

    Please help i have spent forty dollars on this season of arrow and it only downloaded the first episode how do i download the rest?

    Hi handpg2,
    It looks like there are several options for downloading episodes of a TV show.
    iTunes Store download options
    Season Passes and completed TV seasons
    When you buy a TV season or Season Pass, you'll see these options:
    Later: Don't download any episodes now. You can download your episodes later from iTunes in the Cloud.
    Download All: Download all available episodes.
    Download: Download the earliest unseen episode of the season. For example:
    If you haven't downloaded any episodes from a season, episode 1 of that season will download.
    If you've previously bought or downloaded episode 3 of a season, episode 4 of that season will download.
    Thank you for using Apple Support Communities.
    Nubz

  • Search function only returns the first entryinstead of 2600

    Hi all,
    I am using JDNI to search in a iPlanet LDAP. This is the code:
    String filter = "(objectclass=TDC-Empleado)";
    NamingEnumeration resultados;
    SearchControls limitacionesBusqueda=new SearchControls();
    limitacionesBusqueda.setSearchScope(SearchControls.SUBTREE_SCOPE);
    results = ctx.search("o=TDC",filter,limitacionesBusqueda);
    I know with another tool that this filter works but the search function only returns the first entry!!!
    Somebody can help me ?
    TIA
    Manuel

    humm.
    Sets ctx.setCountLimit(long), or else checks the "size limit" of your iplanet server (size limit: number of entries returned to the client application).
    A.V.

  • Creating PDFs using Adobe Acrobat 9 Pro and can only see the first 10 pages in PDF even when the page numbers on bottom state 10 of 13 (or any number greater than 10).

    PDFs create great, unless they should be over 10 pages and then it appears the data was converted to PDF by viewing the page numbers at the bottom of the PDF but you can only view the first 10 pages in the pdf file.

    Hi stephaniec0103,
    Could you please let me know what exact dot version of Acrobat 9 and OS you are using.
    Have you tried repairing Acrobat from the Help menu?
    Acrobat 9 is an older version and incompatible with new OS versions, so I would suggest you to try using Acrobat XI (latest version) and check for the same.
    You may download a 30-day free trial version of Acrobat from the below mentioned link:
    Download Adobe Acrobat free trial | Acrobat XI Professional
    Let me know how it goes.
    Regards,
    Anubha

  • API search will only return the first 200 results????

    It seems that I can only retrieve 200 results when using doOracleSimpleSearch api call.
        osr = oses.doOracleSimpleSearch(strSearch, 1, 1000, false, false, true);
        nCount = osr.docsReturned;
        nCount2 = osr.resultElements.Length;
        nCount3 = osr.estimatedHitCount;nCount and nCount2 are both 200.
    nCount3 is 1332
    Ok, no problem. Even though I asked for 1000 results, I figure it will only return 200 at a time, so I write a simple loop.
       while (nTotalResults < nCount3)
          osr = oses.doOracleSimpleSearch(strSearch, nTotalResults + 1, 200, false, false, true);
          nCount = osr.docsReturned;
          nTotalResults += nCount;
       }After executing the search the first time, nTotalResults is set to 200, so I'm now requesting that the search starts at index 201 and to return the next block of 200.
    osr.docsReturned is now = 0
    stuck in infinite loop because it's not returning all my results.
    Update:
    It seems this is not just an API issue. If I do the search through the web interface, and go to page 20 (it's displaying 10 results per page) I see results. But as soon as I go to page 21, the page is blank even though it says there are over 1000 results.
    Edited by: JimG on Feb 15, 2012 5:17 PM

    You need to change the "Maximum Number of Results" from the Admin GUI.
    Go to Global Settings -> Query Configuration, and you'll find it there.

  • [Solved] DVDs and CDs only work the first time I put them in

    First lets get this straight before it is asked later on down the line. I am a 6 year Linux user and 2 year Arch user. I am currently using xfce4 and thunar as my file manager with thunar-volman installed. This has been a problem for the past year or so. I use my laptop most of the time (also Arch 64 and working like a dream) so I only try fixing it every so often to no avail.
    I can put in a CD or a DVD and play them with VLC. Here's the catch: after I eject the CD/DVD and put in another one I can't play it or find it. The first time I put one in I even get an icon on the desktop. I don't think it's reasonable to have to reboot everytime I want to play another DVD (time wasted by constant rebooting is one of the very long list of reasons I don't use Microshaft products). I'm stumped, I can't be the only one, but my forum searches yield no treasures.
    Last edited by astrozombie (2010-02-03 01:00:15)

    Thanks for trying, however, I posted what I use for a reason. I am using VLC, and I am a minimalist so I don't want a bunch of programs for doing the exact same thing. VLC is the only player for Linux that plays MTS files out of the box, so I'm not interested in switching or adding another.
    Anyways, it's irrelevant because as I said before, thunar mounts it correctly the first time I put in a DVD or CD and displays an icon on the desktop for the disk. Therefore the problem is most likely hal related, since this began about the time we switched to hotplugging, and besides this I love hotplugging so I am also not interested in disabling that (who know what problems I'll introduce for my MAC keyboard and webcam if I do that). Yes I've read the hal and dbus wikis.
    I can even get a USB CD writer to work with xfburn, however it's a relic and I think that's a sorry work around when I have internal drives that, in theory, work just fine. I wonder if it has anything to do with the drives being IDE when I used the SATA install option on the install disk (I did a fresh install last week) since my hard drives are SATA.

  • BindAggregation only returning the first element from a XML node

    hello everyone,
    investigating on this issue since fiew hours, I need your help (did not find a similar issue).
    here is an xml sample:
    <users>
         <user active="true">
              <reference/>
              <name>
                   <prefix/>
                   <first>first</first>
                   <middle/>
                   <last>last</last>
              </name>
              <location></location>
              <identifier>
                   <domain>mydomain</domain>
                   <login>flast</login>
              </identifier>
              <email>
                   <address>[email protected]</address>
                   <type>text</type>
              </email>
              <roles>
                   <role name="A"/>
                   <role name="B"/>
                   <role name="C"/>
                   <role name="D"/>
                   <role name="E"/>
                   <role name="F"/>
                   <role name="G"/>
              </roles>
              <groups>
                   <group name="A1"/>
                   <group name="A2"/>
              </groups>
         </user>
    </users>
    After having set the data in the table:
    oModel.setData(data);               
    oTable.setModel(oModel);
    oTable.bindRows("/user");
    I am able to bind correctly properties like first name & last name in my table... but I am not able to do a bindAggregate on roles !
    When I do this, only the first role is returned everytime for each row.
    With the example above,
    It displays, : first as firstname, last as lastname, & only role A instead of displaying all roles from A to G as above in the xml.
    Here is the bindAggregation:
    oTable.addColumn( new sap.ui.table.Column({
         label: new sap.ui.commons.Label({text: "Roles"}),
         template: new sap.ui.commons.ListBox({  
              "items": {     
                   path: "roles",
                   template: new sap.ui.core.ListItem({text: "{role/@name}",})
    Where is my misunderstanding/mistake ? or how should I deal for having all roles displayed correctly in the listbox of this column ?
    No proposal ?
    Files (javascript & data) for reproducing this behavior are attached below,
    Really thank's in advance to each of you for your coming help,
    Best Regards

    hello everyone,
    investigating on this issue since fiew hours, I need your help (did not find a similar issue).
    here is an xml sample:
    <users>
         <user active="true">
              <reference/>
              <name>
                   <prefix/>
                   <first>first</first>
                   <middle/>
                   <last>last</last>
              </name>
              <location></location>
              <identifier>
                   <domain>mydomain</domain>
                   <login>flast</login>
              </identifier>
              <email>
                   <address>[email protected]</address>
                   <type>text</type>
              </email>
              <roles>
                   <role name="A"/>
                   <role name="B"/>
                   <role name="C"/>
                   <role name="D"/>
                   <role name="E"/>
                   <role name="F"/>
                   <role name="G"/>
              </roles>
              <groups>
                   <group name="A1"/>
                   <group name="A2"/>
              </groups>
         </user>
    </users>
    After having set the data in the table:
    oModel.setData(data);               
    oTable.setModel(oModel);
    oTable.bindRows("/user");
    I am able to bind correctly properties like first name & last name in my table... but I am not able to do a bindAggregate on roles !
    When I do this, only the first role is returned everytime for each row.
    With the example above,
    It displays, : first as firstname, last as lastname, & only role A instead of displaying all roles from A to G as above in the xml.
    Here is the bindAggregation:
    oTable.addColumn( new sap.ui.table.Column({
         label: new sap.ui.commons.Label({text: "Roles"}),
         template: new sap.ui.commons.ListBox({  
              "items": {     
                   path: "roles",
                   template: new sap.ui.core.ListItem({text: "{role/@name}",})
    Where is my misunderstanding/mistake ? or how should I deal for having all roles displayed correctly in the listbox of this column ?
    No proposal ?
    Files (javascript & data) for reproducing this behavior are attached below,
    Really thank's in advance to each of you for your coming help,
    Best Regards

  • HT1725 I downloaded a song and it only plays the first 2 seconds.

    s

    Hello, Malc15.
    You can delete the song in iTunes and download it again for free if purchased from iTunes.  The instructions for this are below. 
    To delete an item from your library:
    Click the item to select it, and press the Delete key.
    Click Remove.
    Do one of the following:
    To remove the item only from your iTunes library, click Keep File.
    To delete the item from your computer, click Move to Recycle Bin. The item is deleted the next time you empty the Recycle Bin.
    To download past purchases from iTunes:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Cheers,
    Jason H. 

  • Bought 2 Cd's on iTunes and it only plays the first 30 seconds of some songs on the album when listed as longer. How can I fix this?

    I bought a few CD's from the iTunes store, Incubus Morning View and Make Yourself. Half of the songs on there play for the full length and the other half only play for about 30 seconds when listed as the full song. Is there anyway to fix this or re-download the songs?

    Assuming you are in a region where you are allowed to redownload your past music purchases, delete the broken tracks from your iTunes library, go to the iTunes Store home page, click the Purchased link from the Quick Links section in the right-hand column, then select Music and Not on this computer. You should find download links for your tracks there.
    If you don't see them straight away it may help to close and restart iTunes.
    While downloading select Downloads in the left-hand column and make sure Allow Simultaneous Downloads is unticked.
    If the problem persists, or that facility is not yet available in your region, contact the iTunes Store support staff through the report a problem links in your account history, or via Contact Support. Do this also if the iTunes LP package itself won't work properly.
    See also: HT2519 - Downloading past purchases from the App Store, iBookstore, and iTunes Store
    tt2

  • ID only imports the first word of a 233 page word file (a novel)

    Folks!
    I've tried the old FIle-Place  make a text box and shift+enter..... and I ONLY get the first word of a 60,000 document.  Why?
    I need help ASAP!

    There are a lot of possibilities causing the problem, probably it is caused by some formatting done in Word.
    What text styles are used in Word? Do they have some break options? Repair them in Word.
    Are text boxes/frames used in Word? Remove them in Word.
    Is in Word some kind of break inserted (section, page, column, …)? Remove them in Word.
    But also important:
    When you import the Word file, do you select the import options during import? Do it!
    In InDesign is a character style selected before importing, before choosing the text tool? Don't.
    Because we don't know the source of the Word file it is hard to tell you what it is. A huge problem are Word files which have been converted from PDF or other programs.
    I would try to get rid from any Word imported formatting. Imported styles from Word I would never use in InDesign, I import them often, but I have my own styles predefined in InDesign. After importing I delete step by step the Word formatting. I know, I could map the Word Styles to existing InDesign styles, but in my experience some unexpected things are happening when the Word file comes from someone else than me, because a lot of people have only limitted knowledge when it comes to Word styles and document structure.

  • Chosing "open all in tabs" only opens the first of the bookemarks in the folder.

    I have upgraded my computer with a new processor, RAM, MoBo and GPU. I also updated to the latest version of Firefox.
    All my bookmarks were transferred over. However there are two main problems. When I select a folder of bookmarks to open and select "open all in tabs" it only opens one tab and then only loads the first bookmark. I tried using a mozbackup to refresh the bookmarks but they still don't open.
    However Firefox does open a load of multiple tabs from a previous browsing session. However the number of tabs is wider than my screen. I used to be able to use the scroll wheel on the mouse button to "flow" the bookmarks across the screen but that no longer works.
    I have also discovered that I can no longer move tabs along.
    All in all FF is stuffed and I am going to have to swap to Opera or another browser as in its current state FF is unusuable.
    Please can anyone make any suggestions as to what I can do?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Why does recursive query only organize the first item in the subquery?

    Following is my recursive function and it only updates the first two item in my subquery..
    select distinct f.DISPLAY_NAME, f.id,f.parent_id, f.sub_folder_sequence
    from WWSBR_ALL_FOLDERS f, WWSBR_ALL_FOLDERS g start with f.id in
         (select g.parent_id from WWSBR_ALL_FOLDERS e
         where
              e.id = g.parent_id AND
              f.id = g.parent_id AND
              e.caid = 103 AND
    e.parent_id <> 0 AND
    e.type_id = 1 AND
    e.display_in_parent_folder <> 0)
         connect by prior f.id= f.parent_id
    order by f.sub_folder_sequence asc, f.parent_id asc, f.id desc;

    following is my result
    DISPLAY_NAME
    ID PARENT_ID SUB_FOLDER_SEQUENCE
    Home Page
    8981 1 1
    Claims
    9192 8981 1
    Advanced Search
    9168 9163 1
    DISPLAY_NAME
    ID PARENT_ID SUB_FOLDER_SEQUENCE
    Sales Chart
    9187 9173 1
    Search
    9163 1 2
    Sales
    9173 1 3
    6 rows selected.

  • I have iTunes Match. When selecting to play an album on Apple TV it will only play the first song not the entire album. How do i fix

    I need help with playing full albums on my Apple TV through iTunes Match. When I select an album to play it only lays the first song.

    if it's not iphone4s or later it does not support airplay mirror

Maybe you are looking for