Double replacement using repalceAll methot of Matcher

Hi all,
I'm using the java.util.regex package in my program.
I have noticed that this code
Pattern p = Pattern.compile(".*");
Matcher m = p.matcher ("anystring");
String s = m.replaceAll ("otherstring");
it like produce a wrong result, the string s going to contain
otherstringotherstring insted of otherstring.
It is wrong? I think this is a bun in JDK.
I'm using the j2se 1.4.1_01-b01 for linux
Anyone can help me?
Thanks

To elaborate on that explanation a little:
The pattern matches the whole input, and replaces it with "otherstring".
Then the pattern is matched against what is left, which is nothing, or "" (the empty string). Your pattern matches that, therefore it is 'replaced' by another occurance of "otherstring".

Similar Messages

  • Frm-41826: Cannot replace group; columns don't match LOV

    Hi-
    I am Oracle ERP developer.
    frm-41826: Cannot replace group; columns don't match LOV
    this message absolutely don't know .
    please help me.

    If it is being created programatically, you may want to do a find on some of these key words..
    CREATE_GROUP_FROM_QUERY
    POPULATE_GROUP
    SET_LOV_PROPERTY
    They should all be within the same section of code, see what is going on in there.. The code may be trying to use a record group the LOV is not designed for ?

  • I have just requested my ipod nano 1st generation to be replaced using the scheme, i have entered the wrong postcode on the shipping of the replacement box, will it still come to my address? or how can i change it?

    I have just requested my ipod nano 1st generation to be replaced using the scheme, i have entered the wrong postcode on the shipping of the replacement box, will it still come to my address? or how can i change it?

    Call up apple care,  (08000480408 if you are in the UK) and ask them to change the postcode and request another replacement packet

  • Can't Drag and Drop with a Double Tap using Single Finger in Lion?

    I installed the Mac OS X Lion two days. But I can't drag and drop with a Double tap using Single Finger, which I used to do in Snow Leopard.
    If I choose Three Finger Move, then Swap Between Pages goes back to "Scroll left or right with Two Fingers" that only works with Safari, but doesn't work with Chrome or Firefox.
    I tried literally every setting in Trackpad and also checked if there was a override settings and there is no overrride setting.
    Would be thankful, if you guys could suggest me what to do?
    ======================================
    My Machine Configuration:
    Macbook Pro 13" (mid 2010)
    Intel Core 2 Duo 2.4GHz
    4GB Ram
    Nvidia Geforce 320m
    Mac OS X Lion (Installe on a updated Snow Leopard 10.6.8)

    Hey Serge many thanks for telling me how to do. now its working like previously
    I just cheked the Dragging under Trackpad option and unchecked Three Finger Moves. now I can drag and drop with a double tap using single finger.
    Thank you guys. You are the best

  • How do I play my iTunes music on my iPad using WiFi and iTunes match (my music is stored in the cloud).

    How do i play my iTunes music on my iPad using WiFi and iTunes match? I don't want to download my music to my iPad.

    But that's what I don't want to do. I think I must have misunderstood what was possible with iTunes Match and the cloud. I had thought I would be able to play my music directly from the cloud using WiFi. I didn't think I would have to download it from the cloud to play it on my iPad. I store it in the cloud because I don't have enough storage space on my iPad -- I can't download all my music because I run out of storage space. If iTunes Match doesn't allow you to play the music FROM THE CLOUD, but instead only allows you to DOWNLOAD IT FROM THE CLOUD TO YOUR IPAD TO PLAY, then it's not serving the purpose I thought it would. What's the point of storing it in the cloud if you have to download it to play it?
    The only way I could imagine it working for me is if it possible to only download particular albums or songs. Or does your whole library have to be downloaded? 

  • I have mulitple copies appearing on my ipad after using icloud and itunes match, how do I get only 1 copy to appear?

    I am new to the Ipad, I just got the Ipad with retina display in and only have a 16gb memory. I wanted to use Icloud for my music and other items, but when I started using Icloud and Itunes match, my Ipad has up to 3 of the same song listed on the song list. and will repeat when I am listening to my music. I was wondering how I can get those multiple copies go away to just 1.

    Hi,
    Read this user tip Recover your iTunes library from your iPod or iOS device
    Does it help?
    Jim

  • Find and replace using wildcard

    I've inserted table content using Insert/Table Objects/Insert Tabular Data in DWCS3 and want to remove unwanted code from the table insert.
    Example:
    <td width=156 valign=top style='width:117.0pt;border-top:none;border-left:
      none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
      mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
      mso-border-alt:solid windowtext .5pt;background:#FF8A50;padding:0cm 5.4pt 0cm 5.4pt'><p class=MsoNormal><span style='mso-bookmark:CurrentPosition'><span
      style='font-size:10.0pt;font-family:Arial'>
    The text between "width" and "Arial'" varies but these two start and end words are the same in each instance to be replaced - how can I find and replace using a regular expression wildcard?  Have researched on web but not come across answer yet.  I thought it might be simple and hopefully it is and I'm just having a shocker. Is it something like Find:  "<td [^"]*> and Replace with: "<td>"?  Am I close?
    I'd appreciate anyone's help and thankyou in advance for your time.

    You might be able to sort this out with Commands > Clean Up Word HTML.
    However, the following regular expression should also do what you're looking for (make a backup first). Put this in the Find field:
    (<td)[\w\W]+?Arial\'(>)
    Put this in the Replace field:
    $1$2
    Select "Use regular expression".

  • How do i double stroke using adobe photoshop elements 10

    how do i double stroke using adobe photoshop elements 10?

    Not sure what you mean by double stroke?
    Do you mean something like two strokes, each with a different color?

  • How to delete double contact using icloud with pc for iphone4

    hoe to delete double contact using icloud with pc for iphone4

    Delete Contacts from iPhone the Fast Way, All or Individually

  • Alternative to replace use of Table BDCP

    Hi Guys,
    SAP table BDCP which is used in START-OF-SELECTION is obsolete in SAP ERP 6.0 EHP7 SP Stack 4 and Data in this table is not maintained any more. I need to find an alternative to replace use of table BDCP. Any one have any idea what can be the alternative?
    Thanks and best regards.
    Fahad

    Hi Fahad,
    I do not see any such information published in SAP. If you have valid documentation please educate the community.
    For your information BDCP contents can be moved to BDCP2 to improvise performance.
    Refer SAP note 305462 - MOD: Migrating change pointers to table BDCP2
    you may query on BDCP2 for faster selection.
    Hope this helps.
    Regards,
    Deepak Kori

  • Catalog manger "search and replace " using xml script

    Hi ,
    we have renamed 6 rpd columns names in rpd & alias is not removed yet .In catalog manager i can search and replace using string .But it takes lot time as they are stored in different reports , which are existing . I am trying to use xml script for replacing them.I got sample script from help file for single column . can anyone help for doing that for multiple strings.I will provide with my inputs .
    my inputs:
    <?xml version="1.0" encoding="utf-8"?>
    <actions>
    <action command="textReplace" oldValue="column 1 " newValue="column one" ignoreCase="true"/>
    <action command="textReplace" oldValue="column 2" newValue="column two" ignoreCase="true"/>
    <action command="textReplace" oldValue="column 3" newValue="column three" ignoreCase="true"/>
    </actions>
    please correct me .

    Given xml content looks okay but just in case check this oldValue="column 1 ", there is additional space at the end.
    I would suggest to extract Analysis report (.csv) using Catalog Manager and find out the list of reports based on those columns.
    This would help you learn with list of reports based on report owners, and then go for the fixing those reports.
    If you go by xml replace you never know the affected reports and you may not confirm until report owners come back to you with issues.
    This might take little bit time but your changes based on proper doc.
    Let me know updates, if helps mark
    Edited by: Srini VEERAVALLI on Feb 19, 2013 3:21 PM

  • I am not able to print double side using HP 2015dn printer using imac

      I am not able to print double side using HP 2015dn printer using imac.

    I found this information on HP site, but the article was quite old. May still be relevant:
    1. Create a multi page document, or something that is more than one page.
    2. Go to File/Page Setup.
    3. Ensure the printer is listed in the Format for menu.
    4. Click OK.
    5. Go to File/Print but do not print yet.
    6. Change the Copies and Pages menu to 'Layout'.
    7. The Two-Sided option will be selectable only if the P2015 is listed in the Printer menu at the top of the print dialogue box.
    8. Once you have chosen Long-edged binding, for example, click Print.

  • How to print double sided using an HP photosmart printer

    How to print double sided using an HP photosmart printer

    Follow the instructions for your Printer?
    We don't even know which one, there must be hundreds of Photosmart models.
    Peter

  • Multi search and replace using excel file

    I am trying to use a script to open multiple indesign files and perform several find and replaces using a delimited word file containing the searches, this script, plagerised from a quark one, opens files but doesnt S&R, can anybody see the error of my ways?
    -- Indesign docs
    set QFolder to "Please locate the folder containing your Indesign documents..."
    set Doc_Folder to (choose folder with prompt QFolder) as text
    set theFiles to {}
    tell application "Finder"
    tell folder Doc_Folder
    repeat with i from 1 to count of files
    if file type of file i is "IDd5" then
    set end of theFiles to file i as text
    end if
    end repeat
    end tell
    end tell
    -- Search Items
    set QFile to "Please locate your Tab Delimited Text file..."
    set Search_File to (choose file with prompt QFile) as text
    set Search_Rows to read file Search_File using delimiter {return}
    set Search_Items to {}
    repeat with This_Row in Search_Rows
    set end of Search_Items to my GetTextItem(This_Row as text, tab, 0)
    end repeat
    --Process
    tell application "Adobe InDesign CS3"
    activate
    --Clear the find/change preferences.
    repeat with oneFile in theFiles
    open file oneFile
    set find text preferences to nothing
    set change text preferences to nothing
    --Set the find options.
    set case sensitive of find change text options to true
    set include footnotes of find change text options to true
    set include hidden layers of find change text options to false
    set include locked layers for find of find change text options to true
    set include locked stories for find of find change text options to true
    set include master pages of find change text options to true
    set whole word of find change text options to true
    tell document 1
    repeat with ThisPair in Search_Items
    set {searchstring, replaceString} to ThisPair as list
    tell every story
    try
    set (every text where it is searchstring) to replaceString
    end try
    end tell
    end repeat
    end tell
    close document 1 saving yes
    end repeat
    end tell
    on GetTextItem(ThisString, ThisDelim, ThisItem)
    -- ThisString -> String to look in
    -- ThisDelim -> Text element that delimit the string
    -- ThisItem -> Number of the element to return (0 for all)
    copy the text item delimiters to OldDelims
    set the text item delimiters to ThisDelim
    if class of ThisItem is list then
    set fromItem to (item 1 of ThisItem) as integer
    set toitem to (item 2 of ThisItem) as integer
    set arrItem to (text items fromItem thru toitem of ThisString)
    else
    set arrItem to every text item of ThisString
    end if
    set the text item delimiters to OldDelims
    if class of ThisItem is list then
    return arrItem as text
    else
    if ThisItem is not equal to 0 then
    return (item ThisItem of arrItem) as text
    else
    return arrItem -- return every items
    end if
    end if
    end GetTextItem
    Thanks

    I can't check your script right now since I'm not on Mac. I recommend you to use FindChangeByList script for CS4 instead (it works with CS3): http://forums.adobe.com/servlet/JiveServlet/download/2080627-12695/FindChangeByListCS4.zip together with Martin Fisher's: http://www.kasyan.ho.com.ua/downloads/RecordFindChange_CS3_Kas.zip
    Use this script to record settings from Text and GREP tabs, then copy and paste them into FindChandgeList.txt file.
    Or, optionally you can use this script: http://www.kasyan.ho.com.ua/find_change_by_queries.html.
    Kasyan

  • HT4914 If I use the iCloud tune match will it free up space on my iPad?

    If I use the iCloud tune match will it free up space on my iPad?

    If you delete the music from the iPhone, yes. But perhaps you should be looking at what else is taking of storage on the iPhone, back it up, and delete those things as well.

Maybe you are looking for

  • Updated iPod touch 5th generation to IOS7, but it fails to activate.

    In order to update my iPod, I had to restore it prior to the update. It finished updating and took me through the set-up. After connecting to my wifi, it leads me to a screen with the message: "Your iPod touch could not be activated because the activ

  • System type for technical system.

    Hi All, I want to create a new technical system for my receiver sys. The receiver is the PI . so its SAP->XI->XI Interface. Can anybady explain what will be the System Type for receiver PI.(web as abap or ...etc) Also pls explain the diffrent system

  • Cannot re-install from ovi

    Hi, i have a problem with the ovi app on my phone, i downloaded a load of apps to my E72 when i bought it and i have just upgraded the memory card to a larger one and gone to re-install the apps as they were saved on the memory card however the downl

  • Time Machine Backups with 10.5.4 and 7.3.2 still work

    Just a note- I've updated my AEBS to 7.3.2 and my MBP to 10.5.4. Time machine backups still work normally. Thanks, Apple, for keeping the function working.

  • MacBook Pro retina 13" vs iMac 21.5" 2011

    When thinking of buying a Mac, I always wanted to have one for my desktop. So I always consider an iMac, but my last birthday present was a MacBook Pro 13" retina. I'm very pleased with it, I enjoy the retina display, the USB 3.0 for my external driv