Regular expressions, using pattern and matcher but not include the pattern

Hi all
i have a regular expression but in my matcher it is including the text that is in my regular expression.
ie
String str="-------------------stuff===========";
Pattern mainBody = Pattern.compile("-----(.*?)=====", Pattern.MULTILINE);this matches -------------------stuff=====
now i expect to get some - in there as i match from the start, but i dont want to have the = in the match. how do i do a match that excludes the matching expressions.

nevermind, figured it out
when i do myMatch.group(1) it gives me just my match
sorry for wasting time :)

Similar Messages

  • HT1844 Library Issue:  I just imported 2 CD's into ITunes.  They show up in "Recently Added" and on my other devices via ITunes Match, but NOT in the ITunes software on the computer where I added them.

    Library Issue:  I just imported 2 CD's into ITunes.  They show up in "Recently Added" and on my other devices via ITunes Match, but NOT in the ITunes software on the computer where I added them.  They show up in the search box, but when I click on the results it just kicks me to ALL my music.  I have imported thousands of songs/CD's before and this is a new one.

    Something may have gone wrong with the index of the Music playlist. Making another change to the library such as downloading the current iTunes Free Single of the Week, or deleting one track from your library and reimporting it, should fix the problem.
    If that doesn't work close iTunes and delete the hidden file sentinel from inside the main iTunes folder, then start iTunes again. It should run a consistency check when it starts up which ought to correct things.
    tt2

  • My University email uses outlook and firefox will not let the page open once i log into the university login. It used to work, but now just shows a completely white tab. My email works fine in other browsers. Why?

    My University email uses outlook and firefox will not let the page open once i log into the university login. It used to work, but now just shows a completely white tab. My email works fine in other browsers. Why?

    Make sure that you haven't left a profiles.ini file.
    * http://kb.mozillazine.org/profiles.ini_file
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • I have lost my iPad 3 (3G). I do not use iCloud and I do not have the 'Find my iPad' app installed. What can I do to find it? Is there another way to bring up a map of where it is?

    Although I have Telstra 3G
    I do not use iCloud and I do not have the 'Find my iPad' app installed. What can I do to find it? Is there another way to bring up a map of where it is?
    I dont know the opperating system but I only got it recently...
    I also have a mac book pro also without iCloud.

    Without Find My iPad having been enabled on it then there isn't any way to locate it - and that would only work if it's connected to a network and hasn't been wiped or had Find My iPad disabled on it.
    If you think that it was stolen then you should report it to the police. You should also contact your carrier and change your iTunes account password, your email account passwords, and any passwords that you'd stored on websites/emails/notes etc.

  • I am wanting to print my iCal calendar, as use it for bookings but not include entries calendar from other people who I've synced with.

    I am wanting to print my iCal calendar, as use it for bookings but not include entries calendar from other people who I've synced with.

    GACU,
    OK, now I think I understand your problem.
    If it is your calendar that is being shared with other users who have been granted editing priviliges, you will not be able to exclude those events from printing.

  • HT2500 When I am viewing the latest message in a conversation in Mail in the preview and want to reply, I hit reply and it does not include the latest message?  I have to double click the latest message to open it and then reply.  Am I missing a setting t

    When I am viewing the latest message in a conversation in Mail in the preview and want to reply, I hit reply and it does not include the latest message?  I have to double click the latest message to open it and then reply.  I find this irritating and would like to skip this step and be able to reply from preview and include that message.  Am I missing a setting to fix this?

    I have found that if you have highlighted some text in the message and then hit reply, the highlighted section is the only bit included in the reply.  You need to click on the message in the middle list rather than the preview pain on the righthand side and it should reply normally.  To check it's doing this, select a message in the middle section of the screnn then use the down arrow to drop to the next message. Hit reply, and it should reply normally.  I hope this helps.

  • Cannot visit a website that I used to and it will not receive the exception.

    I recently updated Firefox and now I can't access a website that I need to and that I used to before the update. It comes up with the connection is untrusted. I have received this before, no big deal. However, when I click the understand the risks and then add exception, it doesn't do anything. The other times I can confirm but not now.

    I recently updated Firefox and now I can't access a website that I need to and that I used to before the update. It comes up with the connection is untrusted. I have received this before, no big deal. However, when I click the understand the risks and then add exception, it doesn't do anything. The other times I can confirm but not now.

  • How to use regular expression using pattern and match concept for this scenario?

    Hi Guys,
    I have a string "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle"
    I need to replace the numbers based on the below condition.
    if more then 5, replace with many
    if less then 5, replace with a few
    if it is 1, replace with "only one"
    below is my code, I am missing the equating part to replace the numbers could any one of you please help me out fixing this.
    private static String REGEX="(\\d+)";
      private static String INPUT="We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
      //String pattern= "(.*)(\\d+)(.*)";
      private static String REPLACE = "replace with many";
      public static void main(String[] args) {
      // Create a Pattern object
           Pattern r = Pattern.compile(REGEX);
        // Now create matcher object.
           Matcher m = r.matcher(INPUT);
           //replace the value 7 by the replace string
    //How to equate the (\\d+)  greater than a number  and use it the below code.
                  INPUT = m.replaceAll(REPLACE);
           //Print the final Result;
            System.out.println(INPUT);
    Thanks and Regards,

    Hi,
    Try the following which makes use of  "appendReplacement" instead with the "start" and "end" methods to locate and check the searched "regExp" string before dynamically setting the "replace" string:
    String regExp = "\\d+";
    String input = "We have 7 tutorials for Java, 2 tutorials for Javascript and 1 tutorial for Oracle";
    String replace;
    Pattern p = Pattern.compile(regExp);
    // get a matcher object
    Matcher m = p.matcher(input);
    StringBuffer sb = new StringBuffer();
    while (m.find()) {
       Integer x = Integer.valueOf(input.substring(m.start(), m.end()));
       replace = (x >= 5) ? "many" : (x == 1) ? "only one" : "few";
       m.appendReplacement(sb, replace);
    m.appendTail(sb);
    System.out.println(sb.toString());
    HTH.
    Regards,
    Rajen
    P.S: Please mark the post as answered/helpful if it resolves your issue for the benefit of all community members.

  • My iPad (4th gen) is stuck in one orientation. It will change if locked, rotated, and unlocked, but not on the fly. I have tried restarting multiple times.

    I have a fourth gen iPad that's a few weeks old. It is stuck in whichever orientation I unlock it in, and will not rotate on the fly.
    I've tried restarting multiple times. I've tried toggling the side-switch to screenlock or mute, on/off, with no success. Tried closing all programs. Tried locking via software and unlocking...
    Still no luck. Any suggestions?
    Thanks,
    M

    Sounds like a hardware failure. Make an appointment at the genius bar of your local Apple Store. There is no magic that can fix a hardware failure.

  • I copied mp3 files from a usb stick and they appear in music folder in finder and on iPhone/ipad with itunes match but not in iTunes?

    I copied mp3 files from a usb stick and they appear in finder in my itunes media/music folder and on my iphone and ipad with itunes match but not in the itunes library?

    Not working.  And it didn't used to be a problem.  iTunes can find the songs with Search Library, but doesn't show in any index (by song, artist or album).  Finding with Search Library offers to play or add to Up Next, but neither actually does anything.  Using File-Add to Library does nothing as well.  The only way I can get the new files to play is to find in Finder and Open with iTunes.
    I suspect Apple is trying to drive me to buy from iTunes store.  Not gonna happen.  If they don't fix this, I'll find another player.
    This worked fine before OSX 10.8.

  • HT1386 I have synced the items from itunes to an iphone 4 without problem, except the two albums I just purchased did not sync.  They show up on the itunes on my desktop and on my ipod, but not on the new iphone.  What do I need to do?

    I have an itunes account and an ipod, and when I purchased 2 albums on the computer they synced straight to the ipod.  I bought an iphone and used the usb cord from the computer to it to sync the itunes albums to the new phone.  Everything transfered, and those were albums I had uploaded (not purchased from the itunes store), except the two albmus I just purchased from the itunes store.  They appear on my itunes on the computer and ipod, but not on the iphone.  What did I fail to do or did I do incorrectly?

    This might sound weird, but here's an idea which worked for me re music that was newly added to itunes and showed up in my ipod but wouldn't play - I simply played the tracks in itunes first, just a second of time or so will do it, not the whole track, then connect the ipod and sync again and this time they played - hope this helps.

  • Airport extreme will connect to some iPhones and iPads, but not all, and will not connect to MacBooks.

    Why will the airport extreme not connect internet to macbook or some iPhones? It will connect to all our iPhone 6's and iPads but not to the MacBooks. The macbook says wi-fi has the self assigned ip address of ___,____,____,___ and will not be able to connect to the internet,

    Have you done a full restart of the network in correct order?
    Shut down everything.. OFF not standby.
    Power on in order.
    Modem.. wait 2min
    Router.. (Extreme??) wait 2min
    Macbook.. Only the Macbook.. do restart anything else yet.
    Any luck??
    No luck reset the Extreme to factory and redo the setup.. this time use all short names, no spaces and pure alphanumeric. Bonus for names <10 characters.
    Use passwords with the same rules.. only can be 8-20 characters.. mixed case and numbers.
    Try again with the Macbook..
    No luck give explicit details of the setup of the whole network.

  • I've twice tried to use iTunes match. It stalls in step 2. I've rebooted my Mac computer and still stalls. Apple's taken the $25 but not delivered the service. Can I get some personal help?

    I've twice tried to use iTunes match. It stalls in step 2. I've rebooted my iMac computer and it still stalls. Apple's taken the $25 but not delivered the service. Can I get some personal help? There are 12,733 songs, a few dozen of which are not going to be in the Apple music library because they are unique to my collection. Also, some titled "Track XX" and no artist. I assume these would either not upload or else just be uploaded. But, after an overnight of step 2, the iTunes match program was still on song number 7384 or 12733 (it was on that number for over 12 hours). Looking in the music library, activating the iCloud icon and status fields, there were hundreds of songs with the status "waiting."

    Lmwilliamson wrote:
    Kernel panics:
    After taking my late 2009 15 inch macbook pro to the apple store, the genius completely erased my computer and reinstalled the Mac OS X software, but the problem still persists. 
    I also took it to my college tech support center, they tried to take the ram out and reinsert it and clean up the dust, but the problem still remains.
    I am able to use my computer in Safeboot mode (only)
    Well it could still be a software problem if you installed a third party program after the OS X wipe and install, because by booting into Safe Mode it disables certain functions of OS X and hardware. Check for updates or problems for all your third party software, include everything, including menulets, System Preference panes, hacks and so forth.
    If you restored any sort of software from backup like TimeMachine, it likely was corrupted data and now is returned.
    If the college tech support found a lot of dust clogging the rear exhaust vents behind the fans, then likely the heat damage done to the machine has already occured and can't be reversed. Video cards are usually first to go, which Safe Mode does disable the video card somewhat.
    Run through this list of fixes, it's systematic in nature, also has a Hardware Test to see what's going on
    ..Step by Step to fix your Mac
    Too bad this is occurring to a mere 4 year old machine, but dust will do that. Here is the culprit that Apple doesn't tell anyone about.

  • Regular expressions with dates and multiple matches

    I am currently attempting to automate modifying start and end dates within a .config file via powershell but I am having issues identifying the regular expression for the end date section since both are on the same line in the file. Below is the string that
    I want to change.
    Sometimes the dates are blank and sometimes the dates are filled in.
    Dates are always in the same format (yyyy-MM-dd hh:mm).
    I also want to note that there are multiple instances of 'StartDate="" EndDate=""' for other applications throughout the same config file so I cannot limit the expression to not include the App name. 
    I do not want to limit the search to a line number since there are instances where admins will add an extra space in the config file that may throw off the line number.
    I want to replace the dates or lack there of in their respective spots on the line below via powershell:
     <App name="TestApp" StartDate="2012-03-22 13:30" EndDate="">
    I am successfully able to use 
    $startRegex = '(?<=<App name="TestApp" StartDate=")([^"]*)'
    to replace the StartDate but I can't seem to single out the EndDate with regular expression. What expression can I use to have it ignore what is in the quotations after StartDate and only pay attention to the EndDate value?
    Below is a snippet: 
    $path = d:\inetpub\website\app.config
    $startRegex = '(?<=<App name="TestApp" StartDate=")([^"]*)'
    $starttime = (get-date).ToString("yyyy-MM-dd hh:mm")
    (gc $path) -replace $startregex, $starttime | set-content $path
    I want to accomplish the same for EndDate.
    Thanks in advance!

    If you do this with XML it will be painless and less prone to error.
    $n=$xml.SelectSingleNode('//App[@name="TestApp"]')
    $n.StartDate=$newstartdate
    $n.EndDate=$newenddate
    $xml.Save($filename)
    \_(ツ)_/

  • My LR 4 suddenly no longer recognized my memory cards. I am using the same cards and cameras but consisitently get the error message:"files not imported because the files could not be read. they are jpg and nef files...I am stuck without my workhorse! Any

    My LR 4 suddenly no longer recognized my memory cards. I am using the same cards and cameras but consisitently get the error message:"files not imported because the files could not be read. they are jpg and nef files...I am stuck without my workhorse! Any advice is helpful. This has never happened in 6 years

    answered in your other thread LR 4 suddenly no longer recognizes files.

Maybe you are looking for

  • Unnable to connect oracle Discover app server.

    Hai Friends... Tried installing 9iAS 1.0.2.1.0 on NT. When i am starting the Oracle Discover plus it is saying that unable to connect to thr oracle discoverer application server, Discover has detected a conflict loading class oracle/discoverer/corba/

  • I phone not activating?

    my i phone is saying , your i phone could not be activated because the activation server is temorarily unavailable? i have tried all day and got the same message, i have just had the phone unlocked so i can use my 02 sim card in it, as it was a previ

  • Interal document links messing with display...?

    I created a eBook with many internal document links in Acrobat with a PDF file exported from Indesign CS3.  When I open it in Digital Editions and start using the links, the layoout of the books gets all screwed up.  Anyone out there have any experie

  • ITunes Music Store Search ERROR?.

    Everytime i search for an artist in the search window of iTunes music store i get this error; ??? "iTunes has encountered a problem and needs to close. We are sorry for the inconvenience." I've tried the program repair & running QT stand alone 7.1 &

  • No service in the phone

    I Update my iPhone 4g to iOS 7.1.2 and when I put my sim there ia no service I tried many way to get it back but they didn't work plz help me