How do I extract a substring when I know what become before and after it

I am able to get the HTML source of a web page and I want to get certain information from it.
I am trying to extract a 1 or 2 digit number but sometimes it is not there but I know that this comes exactly before the number if it exists or not
"</td>
     <td class="alt1">"
Which translates to regex as "</td>\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t<td class=\"alt1\">" Then the number appears just after the "<td class="alt1">" and I want to automatically say its 0 if its not there.
How easy is it to extract that number?

Normally I would be happy to help you, but after several years of trying to help here, I've decided not to contribute anymore because of the piss-poor way in which this site is being administered.
Others are still helping, but more may leave if things don't improve. May I recommend devshed or javaranch?
http://www.devshed.com/
http://www.javaranch.com/
If you would like to complain to the admins of this forum, either click the "Report Abuse" link or the "Feedback" link.
The forum denizen formerly known as [url http://forum.java.sun.com/profile.jspa?userID=2959]jverd

Similar Messages

  • How to create a loop to run total of records for before and after unconstant date

    Post Author: Ann2
    CA Forum: Formula
    Here is the data sample:
    ID period code date
    1  00  I    01/01/1999
    1 00   Z   01/02/1999
    1 00  G   12/05/1999
    1 00  M   01/01/2000
    There are many students with many periods and many codes. I need to save a date when code = 'G' and count separateley records per student/period 2 times - before and equal that date and after that date, so in the end for period 00 I will have 2 values: 3 (before) and 1(after).
    There are periods from 00 to 08. I am counting students abscencies before and after warning letter was sent (code G).
    The result data should look : 00 01 02 03 04 05 06  07  08              00 01 02 03 04 05 06  07  08     Total
                                                3  0   0   0   0   0   0   0   0                 1 0    0   0   0   0   0   0   0        4
    Please help me.
    Thank you.
    Ann2

    Post Author: Ann2
    CA Forum: Formula
    Thank you for your answer, but I do care about the date the 'G' happened, because I need to reset count.
    The logic behind is this:if a student absent for more than 8 times per period - the letter will be sent out to the parents , that will be code 'G' with period '-1' (it may happen that there will never be code 'G' , but I need to track all absencies). Once the letter is sent, the count starts over (the count starts over the next day after code 'G'). The absencies which happened before or the date the letter sent should count toward 'previous'  abscenices, all other - absenices after the letter.
    So basically I need total per period and total per period before or the day with code 'G'.  Running total with reset with formula code = 'G' does not work.
    I created a formula field which has global date (when code 'G' happenned) and it says if globaldate >= periodDate then date (1900,01,01) else (2100,01,01) and that formula is ok, but I can not use it in running total or can not create group on it and insert total.
    Please help me with this. Thank you.
    Ann2

  • HT1660 My "itunes library" folder is empty.  My libray music (prior to upgrading itunes) is now in an .xml file in my itunes location under my music.  How do I extract/convert this .xml file to a Itunes database and restore my Itunes music library??? Than

    My "itunes library" folder is empty.  My libray music (prior to upgrading itunes) is now in an .xml file in my itunes location under my music.  How do I extract/convert this .xml file to a Itunes database and restore my Itunes music library??? Thanks, Tom

    Empty/corrupt library after upgrade/crash
    Hopefully it's not been too long since you last upgraded iTunes, in fact if you get an empty/incomplete library immediately after upgrading then with the following steps you shouldn't lose a thing or need to do any further housekeeping. In the Previous iTunes Libraries folder should be a number of dated iTunes Library files. Take the most recent of these and copy it into the iTunes folder. Rename iTunes Library.itl as iTunes Library (Corrupt).itl and then rename the restored file as iTunes Library.itl. Start iTunes. Should all be good, bar any recent additions to or deletions from your library.
    See iTunes Folder Watch for a tool to catch up with any changes since the backup file was created.
    When you get it all working make a backup!
    tt2

  • I just upgraded my ipad OS and now my ipad is not picking up the 3G network.  Why and how do I fix this?  When I go into cellular data and view account it says my ipad is activated and ready to go.  What gives???

    Why and how do I fix this?  When I go into cellular data and view account it says my ipad is activated and ready to go.  What gives???
      It was working fine up until I upgraded the OS which I hadn't done in many versions so the ipad was not working as well as it should.  Now it is searching for the network. 

        Hello noodles074!
    Let's get your device working again! It's possible that your device just needs to be reprovisioned on our network. Please go to Settings>General>Reset>Subscriber Services>Reprovision Account. This may take several minutes. After allowing about 5 minutes for completion, please power your iPad off and back on, and test it again. Let us know if this takes care of it!
    Thank you,
    MichelleH_VZW
    Follow us on Twitter @VZWSupport

  • When I try to sync my ipod it shows that i have 2 gigs of other stuff. I dont know what it is and it is taking up space. how do I get it off?

    When I try to sync my ipod it shows that I have 2 gig of "other" stuff and I don't know what it is and it is taking up space. How do I get it off?

    You need to restore you iPod to gedure the "other" to its normal of less than 0.5 GB.  A restore from backup works if the large other is not in the backup.  Make sure that you turn off outo syncing (iTunes>Preferences>Device and check the box that says Prevent iPOds....syncing.  Otherwise, the backup will contain the other.

  • How do i unfreeze my ipod when ive already tried the menu and select button and that didnt help?

    how do i unfreeze my ipod when ive already tried the menu and select button and that didnt help?

    How long did you press and hold both the Select (Center) and Menu buttons together?  Have you tried doing this procedure more than once?  Is the hold switch in the Off position?
    If nothing else, let the iPod's battery fully drain. Then charge it back up again.
    B-rock

  • I have a macbook from early 2008, and when I sign onto safari I get an error message for fast browser search plugin.  After that error comes up my computer freezes and I have to force it to shut down.  Does anyone know what that means and how I can fix it

    I have a macbook from early 2008, and when I sign onto safari I get an error message for fast browser search plugin.  After that error comes up my computer freezes and I have to force it to shut down.  Does anyone know what that means and how I can fix it?

    Means you have an incompatible Safari extension installed. Look in the /Home/Library/Safari/Extensions/ folder for the offending plug-in and delete it.

  • How can I remove unread messages when I know I don't have any?

    How can I remove "unread messages" when I know I do not have any?

    Hit the num lock button again. Num lock forces only the numeric keypad underlying keys to work as a  numeric keypad, and the rest of the keyboard won't work.  Unfortunately Apple stopped including the numeric keypad hidden keyboard key labels on its keyboards.  They used to include them.  They are known as mouse keys: http://docs.info.apple.com/article.html?path=Mac/10.5/en/cdb_moskys.html

  • How do I Restore previous session when I have it setup correctly and it did not restore from last session? I have General is set to Show my windows .....

    How do I Restore previous session when I have it setup correctly and it did not restore from last session? I have General is set to Show my windows and tabs from last time and Privacy set to remember history.
    These to pages do NOT apply: https://support.mozilla.org/en-US/kb/restore-previous-session
    https://support.mozilla.org/en-US/kb/how-do-i-restore-my-tabs-last-time
    There is No option to restore previous session when I go into History. There is No Recent history in the History. It will show my history if I click on show History, but it won't restore it!

    Hi StuckAtHomeMom
    try in PRIVACY panel to set : Firefox will: Use custom settings for history and :
    Uncheck: [ ] "Always use private browsing mode"
    Uncheck: [ ] "Clear history when Firefox closes"
    check everything else and in Accept third-party cookies, set Keep until: they expire
    thank you
    Please mark "Solved" the answer that really solve the problem, to help others with a similar problem.

  • How do I extract my music files from a evternal hard drive and put them on my itunes?

    how do I extract my music files from a evternal hard drive and put them on my itunes?

    If you used the Finder to move the files, iMovie will have lost track of them. iMovie holds the locations of the Event files, and Project files contain references to those locations. If you move the files, iMovie has no way of knowing where they are.
    If you can, first move all the files back to their original locations. Plug in the external drive. Open iMovie and move the files in iMovie's interface (help explains how, but basically, just drag and drop in the event pane).
    Then you can connect the drive to the new computer, and iMovie will see them.

  • HT201328 how do i unlock my iphone4 when i reently chnaged the password and forget the new code

    How do I unlock my Iphone4 when I recently changed my password and forgot the new one?

    http://support.apple.com/kb/ht1212

  • How can you change apps store when you travel around the world?  After upgrading to IOS6, suddently my iPad has switch me to the greek apps store instead of leaving me into my canadian apps store.  Therefore, I cannot upgrade 60  apps on my iPad.

    How can you change apps store when you travel around the world? 
    After upgrading to IOS6, suddently my iPad has switch me to the greek apps store instead of leaving me into my canadian apps store.
    Therefore, I cannot upgrade 60+ apps on my iPad.
    Does someone know how to revert this situation?
    Thanks for your help!

    Try this:
    1. App Store>Feature>Apple ID (at bottom of page)
    2. Tap on Apple ID>View Apple ID
    4. Enter your password
    5. Country/Region>Change Country or Region

  • Every so often when using safari my bookmarks disappear and then later the list shows up again.  Does anyone know what causes this and how to fix it?

    Every once in awhile while using safari my bookmarks list disappears.  Later it just shows up again.  Anyone know what causes this and how to fix it?

    I have had exactly the same problem now with two mini iPads.  Everything was tried; 1) restarting; 2) restoring factory settings etc.  NONE worked.  Eventually Apple agreed to replace it.  I have had the replacement now for two to three months and exactly the same thing is happening again. So off to Apple tomorrow to get another replacement.
    I am quite a heavy user of the iPad so wonder if this is something to do with the fault.
    It is so frustrating as sometimes reset works, and then after 10/20/30/40 minutes (you pick) it goes unstable again.

  • Safari and calendar won't open due to 'calendar persistence plug in' problem.  Anyone know what this means and how to resolve it please?

    Safari and calendar won't open due to 'calendar persistence plug- in problems'.  Does anyone know what this means and how to resolve it please?
    mac book pro with Mavericks 10.9.5

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    For this step, the title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    In the top right corner of the Console window, there's a search box labeled Filter. Initially the words "String Matching" are shown in that box. Enter the name of the crashed application or process. For example, if iTunes crashed, you would enter "iTunes" (without the quotes.)
    Each message in the log begins with the date and time when it was entered. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    ☞ The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    ☞ Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ User Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of crash reports. The name of each report starts with the name of the process, and ends with ".crash". Select the most recent report related to the process in question. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.
    If you don't see any reports listed, but you know there was a crash, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report—they're very long and rarely helpful.

  • Why when i want to download a free app from app store it asks for my apple id and when i give my apple id it then says "this apple id has not yet been used in the itunes store". i dont even know what that means and it will this happen everytime?

    why when i want to download a free app from app store it asks for my apple id and when i give my apple id it then says "this apple id has not yet been used in the itunes store". i dont even know what that means and it will this happen everytime?

    If you are within 14 days of purchase you can still return the iPhone and get the phone that suits your needs, however, I think you will find that no matter which phone you get the content provider will want to know how you are going to pay for future purchases. For Android phones it is Google, and they will certainly want to know.
    To create an Apple account without a credit card see: http://support.apple.com/kb/HT2534

Maybe you are looking for

  • Droid Razr M not working with Verizon tones app or media store.

    I have a Droid Razr M and all software and such are updated where they need to be.  Recently I tried to use the Verizon Tones app to download a ringtone and got an error message that it was having trouble connecting, I was connected to my wifi.  Then

  • To Add attachment to the Mail

    Hi Gurus, I am using the folwing program to sent mail to sapusers. In that i want to add Attachments. i dont know how to do? Can anyone Help me. *& Report  ZMAIL1                                                      * report yvenkatesh_send_express_m

  • What can I do about an account who's owner has passed away?

    So theres an update on my iMac that my father purchased last year for Garageband, iMovie, and iPhoto. He passed away shortly after buying the it and I received the Mac. I've forgotten  the password we created for his account because its been a while

  • IDOC status 30 but partner profile is set to send immediately (04)

    Hi guys, I have a problem with idocs not being sent immediately... The outputs, the EDI partner profiles are all set up correctly... it is configured to send immediately however, it's not doing so... prior to upgrade to ECC 6.0 it's working fine... n

  • Hey all you pros, question for you...

    I am a new convert, and I and trying to learn all the ins and outs of mac worship. With the one-button mouse (i got myself a cute little wireless one here...), are there shortcut keys to do more with the mouse? I wasn't particularly fond of the might