Need to replace the string that contains '|'   character using replaceFirst

I have the code snippet like this
               String aaa= "HEY | PRAKASH, HOW ARE YOU";
               String bbb = aaa.replaceFirst("HEY | PRAKASH", "HI");
               System.out.println(bbb);
I want the output as
HI,HOW ARE YOU
But the output I am getting is      "HI| PRAKASH, HOW ARE YOU"
Wat is the issue with '|' symbol, is there any way to achive this......

String aaa= "HEY | PRAKASH, HOW ARE YOU";
String bbb = aaa.replaceFirst(java.util.regex.Pattern.quote("HEY | PRAKASH"), "HI");
System.out.println(bbb);

Similar Messages

  • Need to process the records that are selected using checkbox in an ALV

    Hi ..
    I am displaying some data in an ALV using the Parent-child relation, the parent records has a check box which is input enabled.
    On click of a button on the toolbar, i need the checked records to be fetched and processed.
    Please help me on how to fetch the records that are checked..
    Thanks,
    Derek

    Hello Derek,
    Is ALV created using OOPS or using conventional FM?
    If you are making use of OOPS technique, then call this method:
    CALL METHOD <grid_name>->get_selected_rows.
    BR,
    Vishal.

  • Problem in replacing the String in a Fille.

    I need to replace the String in the text file, am able to do it partially.
    I mean, am able to replace it. But there are some discrepancies if the replacement string is of "less" or "more" in length than the existing one.
    I solved it for the replacement string of less size, but am unable to do it for the string of more size.. :(
    The problem am facing is "when the replacement string is larger than the existing one, then the other subsequent line in the file gets overwritten".
    I have used RandomAccessFile class for reading and writing the same file.
    fpointer1 = randomFile.getFilePointer() - strLine.length() - 2;
    strLine1 = strLine;
    int sInd = strLine1.indexOf('\'');
    int eInd = strLine1.indexOf(';');
    String oldStr = strLine1.substring(sInd + 1, eInd - 1);
    strLine1 = StringUtils.replace(strLine1, oldStr, newStr);
    if (oldStr.length() < newStr.length()) {
    int diff = (newStr.length() - oldStr.length()) + 1;
    randomFile.writeBytes("\r\n");
    for (int i = 0; i < diff; i++) {
    randomFile.writeBytes(" ");
    randomFile.seek(fpointer1);
    randomFile.writeBytes(strLine1);
    } else if (oldStr.length() > newStr.length()) {
    randomFile.seek(fpointer1);
    randomFile.writeBytes(strLine1);
    int diff = (oldStr.length() - newStr.length()) + 1;
    for (int i = 0; i < diff - 1; i++) {
    randomFile.writeBytes(" ");
    randomFile.writeBytes("\r\n");
    break;
    }Can u pls help me in resolving this issue???...

    boopathi wrote:
    As u said the overwriting causes the problem, but i managed to resolve for the string of less size.I assume you did this with some padding? That's not exactly a clean solution.
    So thats why am seeking to manage the larger size string to replace without overwriting the sub sequent lines.
    Can you help me in suggesting whether it can be resolved using the getFilePointer() and seek() methods??...No you can't.
    Whether you shorten or lengthen the position where you modify the file, you need to move the remaining bytes back or forward, depending which is the case.
    You managed to solve the first case by printing out padding, so you don't need to move the bytes back, but you can't solve the other case like this. You can lengthen the file and move the remaining bytes forward, but I probably wouldn't bother since a simple Reader-based approach is a lot better and easier to get right.

  • I know the name of an object - how do I get the name of the object that contains it?

    If I have a Movieclip, I can trace the name of the Movieclip
    that contains it using the _parent property.
    With a generic object, is there a way to trace the name of
    the object that contains it?
    Please, please tell me - this will be a huge help.
    Thanks

    Thanks for these comments - my problem isn't with MovieClips.
    I need to know if there is something which is the generic Objects
    equivalent to the MovieClips _parent property.
    Here's some code that hopefully will help explain further:
    class MyClass extends Object {
    var myObject:Object;
    function MyClass (){
    myFirstObject = new Object();
    myFirstObject.theParent = this;
    private function getNameOfParent(p_object:Object){
    // Some code to return the name of the object that contains
    p_object
    trace(p_object.__proto__); // Output: [object Object]
    trace(p_object._parent); // Output: undefined
    trace(p_object.theParent); // Output: [object Object]
    return ???
    public function doSomething(p_num:Number){
    var parentName = getNameOfParent(myObject);
    // do some more action...
    Timeline code:
    var myClass1 = new MyClass();
    myClass1.doSomething();

  • I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    I never used LabView but need to generate a RS-233 serial output string that contains an IRIG timestamp based on a contact closure. Is LabView an appropriate tool to do this? How much does it cost to get started with the product?

    Labview isn't cheap, but it would certainly allow you to build a program (set of vi's - virtual instruments) that would do what you describe. Where would the timecode information come from? Your vi, or program, would: Start up, initialize the serial port, loop until a trigger happened, read the timecode (from where?), output that timecode out the serial port in a loop until you pressed the stop button. There is a free evaluation of Labview software available from NI - the base product itself runs about $995.
    - Dave

  • I I have a late 2005 power PC G5 that I want to bring back to life.  I need to replace the original hard drive, a Maxtor 250 GB Sata.  Can I replace it with modern drives, SATA 5-6 etc?

    I have a late 2005 power PC G5 that I want to bring back to life.  I need to replace the original hard drive, a Maxtor 250 GB Sata.  Can I replace it with modern drives, SATA 5-6 etc?

    I knew I should never get rid of my old G5's.  By the way, there is a browser still supported for the PPC, TenFourFox, if you're not using it already.  Go to the Floodgap website (they author it)  download it for free.  The only thing it doesn't support is the Flash plugin, but the browser works great. Other video types are supported.  It's based on Firefox, and runs most of the plugins and add-ons. It's very fast, and beats all other browsers on the browser compatibility and speed test.  That's now my default on my G5's.  Firefox and Safari are no longer supported.  As far as the OS, both Tiger and Leopard were solid for me.  The reason, as I stated before, was iMovie.  The version in Tiger with iLife was far superior to what Apple changed it to.  They 'dumbed it down' for the masses.  Even the newest iLife 11 on my Mac Pro quad isn't is good, in my opinion.  So Leopard should be fine for you.  It's a much larger browser in terms of sheer megabytes and disk space, but it's fine.  As far as getting an OS disc, I'm seeing Tiger for about $45.00, Leopard for $50 - 60.00 on that famous auction site.  As far as RAM, I have 8GB in my G5 2.3, but you should check Activity Monitor when you are running your apps.  See how much green slice you have left (unused RAM).  You might find you don't need eight.  A Mac Pro will grab more free RAM than a PPC machine will.  I have a hard time maxing out use of my 8 on the PPC.  Not true with the eight on my Mac Pro.  The OS doesn't hesitate to grab and use it.  You might be OK with 6GB on your PPC. More will not make you faster, as long as you still have free RAM available.  As far as backup on your resurrected machine:  look for a firewire enabled backup if can.  Use CCC (Carbon Copy Cloner) and make a clone backup.  Next time your PPC machine wipes out the hard drive, just take your Firewire drive and plug it into another PPC machine, and you can select it as your boot drive. You'll be back and running in five minutes.  You can also take the physical drive out of your enclosure, and put it in your tower to replace the failed drive, and you'll be back to where you were in less than ten minutes, OS and all.  The PowerMac has an 800 port, so you can do the 800 on the machine to an 800 port on your backup. A firewire 800 to 800 cable is only about $8.00.  It runs nice and fast through the 800 port.  I like the OWC Mercury Extreme enclosures.  They use USB, Firewire 800, and eSATA, so all your options are open.

  • I have a new computer and downloaded the latest version of itunes.I now need to authorise my computer but cannot find the bar that contains " store windows help" any suggestions please?

    i have a new computer and downloaded the latest version of itunes.I now need to authorise my computer but cannot find the bar that contains " store windows help" any suggestions please?

    Press Alt or Ctrl+B.
    tt2

  • Need a parked/blocked report that contains both the FI and MM number for ea

    Hi Guys,
    Business need a report which contains the translation of 'MM' numbers (typically beginning with '51') assigned for parked PO invoices vs. the 'FI' document number that comes out in the parked report. 
    Ideally, business need a parked/blocked report that contains both the FI and MM number for each record.
    Can someone help me pull this report from MM
    Thanks and Regards,
    Habeeb

    Hello Habeeb,
    Check out the report MR43 which gives information about Parked invoice. Also you can have a look on MIR6 with check box Parked Innvoice.
    The main table for parking invoice is VBKPF and other relevent tables are as follow:
    VBKPF                          Document Header for Document Parking
    VBSEC                          Document Parking One-Time Data Document Segment
    VBSEGA                         Document Segment for Assets Document Parking
    VBSEGD                         Document Segment for Customer Document Parking
    VBSEGK                         Document Segment for Vendor Document Parking
    VBSEGS                         Document Segment for G/L Accounts Document Parking
    VBSET                          Document Segment for Taxes Document Parking
    Hope this helps.
    Regards
    Arif Mansuri

  • In 7u51, will all jars referenced by the applet need to be updated to include the Permissions Manifest attribute ? Or, will it be limited to the jar that contains the applet code ?

    To whom it may concern,
    According to Java RIA checklist(http://www.oracle.com/technetwork/java/javase/overview/ria-checklist-2055184.html),
    as of 7u51(January 2014), Permissions Manifest attribute in main JAR file will be required.
    But, at least, as of 7u45, when the Security Level slider is set to Very High,
    a jar without Permissions Manifest attribute, which doesn't contain the applet code but is just referenced by the applet,
    prevent the applet from running.
    So, the question is:
    In 7u51, does it mean that all jars referenced by the applet need to be updated to include the Permissions Manifest attribute ?
    Or will it be limited to the jar that contains the applet code?
    There is a concern that we will have to modify library jars that we do not control.
    Sincerely,
    Toshio Shiko

    Thank you for your quick response and your investigation!
    It do help us very much.
    But, unfortunately, for the moment, I'm not allowed to test the early access version.
    As soon as circumstances are changed, I' d like to test it.
    Again, thank you for your providing of the useful information.

  • How do I assign a file to a drive other than the drive that contains my program software?

    I've just installed a video editing program on my new Mac Pro Xeon 64 bit workstation. I want to ensure that all my media files reside on a drive other than the drive that contains programs. I had no problem doing this on my old Dell. How do I do this on my Mac Pro? -- Gary

    Application Preferences.
    Next time, 'what' program would also help.
    Most people do setup with a dedicated boot drive with OS and apps, .then use other drives or array(s) for media, scratch as needed, including external hardware RAID.

  • How to replace the string in a file

    Hi, I have a file which contains the following data
    File.dat
    <file>
    <filenum>
    W10
    </filenum>
    <hello>Heading </hello>
    </file>
    I need to replace the contents of file.dat
    database sequence value (for example xx_seq.nextval)
    Can some one please tell me how to search this <filenum>
    W10</filenum>
    and replace this with xx_seq.nextval
    and write the entire contents of the file to new file
    I am doing some thing like this
    suppose if my database value returns 11 from the above sequence then
    the output should be in file2.dat as
    <file>
    <filenum>
    11</filenum>
    <hello>Heading </hello>
    </file>
    declare f_in utl_file.file_type;
    s_in varchar2(10000);
    string1 varchar2(32000);
    x number;
    begin
    f_in := utl_file.fopen('SAMPLEDIR','input.txt','R');
    f_in1 := utl_file.fopen('SAMPLEDIR','input1.txt','W');
    select xx_seq.nextval into x from dual;
    loop
    begin utl_file.get_line(f_in,s_in);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    EXIT;
    string1:= string1 || s_in;
    utl_file.put_line( (f_in1,s_in);
    end;
    end loop;
    utl_file.fclose(f_in);
    end;
    In this case it is reading and writing as it is, but unable to replace the sequence value
    Can some one please tell me how to do using replace function
    Thanks

    Hi, I have tried this but getting error
    step 1: create table test_dept(dno number, dname varchar2(20))
    insert into test_dept values(10,'10-Sourcing dept');
    insert into test_dept values(20,'20-Audting dept');
    insert into test_dept values(30,'30-Computer dept');
    select * from test_dept;
    DNO DNaME
    10     10-Sourcing dept
    30     30-Computer dept
    20     20-Audting dept
    step 2:
    create table test_web (name varchar2(60), xml_col xmltype) ;
    step 3:
    create sequence test1_seq start with 100 increment by 1
    step 4:
    test.out has the following contents (it is not .xml file) and i dont have <?xml version="1.0" ?> tag at the begining
    <File>
    <File_Type>Type1</File_Type>
    <File_Header_Record>
    <file_num>WP10</file_num>
    </File_Header_Record>
    <Transaction>
    <Transaction_Type>TR 1</Transaction_Type>
    <Amount>
    <Amounts>100</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Sourcing</Dept_Type>
    <Dept>10</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 2</Transaction_Type>
    <Amount>
    <Amounts>200</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Auditing</Dept_Type>
    <Dept>20</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 3</Transaction_Type>
    <Amount>
    <Amounts>300</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Computer</Dept_Type>
    <Dept>30</Dept>
    </Depts>
    </Transaction>
    </File>
    step 5:
    DECLARE
    v_check_file_exist BOOLEAN;
    v_file_length NUMBER;
    v_block_size NUMBER;
    v_file_path VARCHAR2 (100);
    v_file_name VARCHAR2 (100);
    v_file_type UTL_FILE.FILE_TYPE;
    v_str varchar2 (32760);
    v_cnt number;
    v_seq number;
    --check whether file exists and has data in it
    BEGIN
    v_file_path := '/usr/tmp';
    v_file_name := 'test.xml.out';
    -- initailise the variables
    v_cnt := 0;
    UTL_FILE.FGETATTR (v_file_path,
    v_file_name,
    v_check_file_exist,
    v_file_length,
    v_block_size);
    if v_check_file_exist
    then
    DBMS_OUTPUT.put_line (' File exists');
    IF v_file_length > 0 AND v_block_size > 0
    THEN
    BEGIN
    select test1_seq.nextval into v_seq from dual;
    insert into test_web values(v_seq,v_file_name);
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    DBMS_OUTPUT.put_line ('No data found '||SQLERRM);
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('others '||SQLERRM);
    END;
    commit;
    ELSE
    DBMS_OUTPUT.put_line ('No Data in File');
    END IF;
    ELSE
    DBMS_OUTPUT.put_line (' File Not Available');
    END IF;
    END;
    I am getting below error
    File exists
    others ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML
    processing
    LPX-00210: expected '<' instead of 't'
    Error at line 1
    My requirement is to replace the
    1. contents of the file WP10 from <file_num>WP10</file_num>
    with sequence value 'WP101' because sequence is starting at 100
    2. Replace all Dept tag <Dept>30</Dept> with Dname value from test_dept table
    for example
    <Dept>10</Dept> should be replaced with <Dept>10-Sourcing dept</Dept>
    update the
    when i say select * from test_web;
    It should contain this row
    101 <File>
    <File_Type>Type1</File_Type>
    <File_Header_Record>
    <file_num>WP101</file_num>
    </File_Header_Record>
    <Transaction>
    <Transaction_Type>TR 1</Transaction_Type>
    <Amount>
    <Amounts>100</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Sourcing</Dept_Type>
    <Dept>10-Sourcing dept</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 2</Transaction_Type>
    <Amount>
    <Amounts>200</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Auditing</Dept_Type>
    <Dept>20-Audting dept</Dept>
    </Depts>
    </Transaction>
    <Transaction>
    <Transaction_Type>TR 3</Transaction_Type>
    <Amount>
    <Amounts>300</Amounts>
    </Amount>
    <Depts>
    <Dept_Type>Computer</Dept_Type>
    <Dept>30-Computer dept</Dept>
    </Depts>
    </Transaction>
    </File>
    Can you please check
    Thanks

  • My iphone 4s is over 2 years old and I need to replace the battery. How much will this cost at an Apple store?

    I have an iphone 4s that is  over 2 years old. The phone's battery is no longer able to hold a  charge for an acceptable length of time.  Assuming I need to replace the battery, how much will this cost at an Apple store?

    graciebethgrant wrote:
    Basically, I'm new to Apple, despite using them before, but I've never actually owned my own.
    Since buying this phone off a colleague at work, I seem to be having problems with it. First, I noticed how rubbish the battery life is, then my charger almost went up in flames and thirdly my camera lense is scratched beyond belief.
    I know the phone isn't within warranty, although I was lead to believe it was before and during buying it, so basically I'm extremely disappointed with the general make up of iPhone's considering they cost such a **** of a lot of money, you'd think they'd be built to last.
    Back to my main point, how much would it cost for a new battery? Or a new camera lense if anyone can help me with that? (I know that the back of the phone was refurbished just before my buying it, so literally just the camera lense)
    Thanks!
    So basically it sounds like you bought an abused used iPhone and somehow that makes the phone subpar because dispite the abuse it should still last forever and look like new? Batteries don't last forever, even under ideal conditions, so your expectatoins are unrealistic. Take it in and have an estimate done.

  • I need to replace the HD on a p7-1206 with a SSD

    I need to replace the 2TB system hard drive in a Pavilion p7-1206 with a 120GB SSD. What is the best procedure for transferring the Win 7 OS to the much smaller SSD? I created the recovery disc set. After starting the Recovery Discs to install the OS on the SSD an error message said that SSD capacity was less than the original disc and stopped the install process. Do I need a procedure that will reproduce all 4 partitions on the SSD in working order or can some partitions be ignored?
    Thanks for your help.
    This question was solved.
    View Solution.

    MusicCity wrote:
     ...  Do I need a procedure that will reproduce all 4 partitions on the SSD in working order or can some partitions be ignored?
    Thanks for your help.
    Hi,
    No, this also won't work. Hope the following tutorial helps:
       http://www.overclockers.com/forums/showthread.php?t=670079
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • I received a low ink warning on my mac for my epson artisan 837 printer. I replaced the cartridge that was low but it still reads low ink on the mac but reads full on the epson control panel. I am also receiving a communication error between the mac

    I received a low ink warning on my mac for my epson artisan 837 printer. I replaced the cartridge that was low but it still reads low ink on the mac but reads full on the epson control panel. I am also receiving a communication error between the mac

    What exactly is the error?
    And, we'd need some info re. your Mac model and OS version - you are not running iOS on it.
    You need to realize that this model has been discontinued and the last driver updates are dated about a year ago. If you are running Mavericks, there may not be an updated driver for it. But you can try to delete the printer and add it again to see if that will work.

  • What are the tables that Contains DTP Filter Entries

    Hello,
    for the filter entries on a DTP Process I found the table RSBKSELECT "Selections for DTP Request (Summary)". But that holds only value which are done generic by Formula etc. but not the information which are entered manual.
    Does anybody knows the table for the rest of entries ??
    I need this Information to Report these Filter as Selectioncriteria.
    Thank for any help
    Henning

    Hi,
    Please note that I was able to link the tables by this kind of code:
    "Get the request from the cube, to identify them.
        CALL FUNCTION 'RSSM_ICUBE_REQUESTS_GET'
          EXPORTING
            i_infocube     = LV_IC
          IMPORTING
            e_t_request    = LT_REQUEST
          EXCEPTIONS
            wrong_infocube = 1
            internal_error = 2
            others         = 3.
    "Check each request
        LOOP AT LT_REQUEST INTO LS_REQUEST.
          "Populate LV_REQUID_CHAR to be able to read the table RSBKSELECT
          "The key is : Request id, without leading 0, right justified, and shifted one time to the left.
          LV_REQUID_CHAR = LS_REQUEST-PARTNR.
          SHIFT LV_REQUID_CHAR LEFT DELETING LEADING '0'.
          SHIFT LV_REQUID_CHAR RIGHT DELETING TRAILING SPACE.
          SHIFT LV_REQUID_CHAR LEFT.
          "Get the filters
          SELECT  *
            INTO TABLE LT_RSBKSELECT
            FROM RSBKSELECT
            WHERE REQUID = LV_REQUID_CHAR.
    ENDLOOP.
    The internal table LT_RSBKSELECT will now contains all the filters used by the DTP.
    It is way better than using the field that contains the concatenation of all filters since it is limited to 255 characters.
    Hope it helps.

Maybe you are looking for

  • I need to have two time zones on the same iCal appointment

    I work accross four time zones, two of which do not observe Daylight Saving Time (DST). This means that when I'm booking my flights on iCal, it would be usefull to have two time zones in the same iCal appointment (Outlook, for instance, allows this).

  • How to generate as XML output from Oracle Apps 11

    Hi Anyone has the experience to generate the output from Oracle Apps 11 as XML file? Database is 8.1.7, Oracle Apps 11. The concurrent program can be written in PL/SQL or can report 2.5 generate the output as XML? The scenario is: 1) Run a concurrent

  • Nested datatable

    Hello! I want to display data table with nested loops using EL. My backing bean is a controller for the parent hibernate entity, lets call it UserGroup (and it has User childs), then I want to display UserGroups with User list for each UserGroup. I l

  • Elements 10 and RAW files?

    Elements 10 and RAW files? Message title was edited by: Brett N

  • Want to know development procee

    Hi Experts, i want to know the step by step process fro portal implementaion/development in technical point of view . like how you move the code from Dev Server-> Con server->Test ser->Production here i want to know step by step procvess to do the co