Java Regex Pipe Delimited ?

Hello
I am trying to split the string which is pipe delimited. I am new to Regex and new to Java.
My Java/Regex code line to split is:
listColumns = aLine.split("\\|"); // my code has 2 backslash-escapes chars plus 1 pipe char but this forum does not allow me to put pipes or escapes correctly and plain text help is of NO HELP 8^(
My input string has 3 leading and 4 trailing pipe characters
My Output from split: (3 leading emptry strings work but 4 trailing pipe delimiters dont work)
SplitStrings2:[]
SplitStrings2:[]
SplitStrings2:[]
SplitStrings2:[col1]
SplitStrings2:[col3]
SplitStrings2:[col4]
I do get 3 empty strings for all 3 leading pipes but no empty strings for the any traling 4 pipe characters.
What do I need to change the code such that all repeated pipes resulted in same number of empty strings returned by split method?
thanks
YuriB
Edited by: yurib on Nov 28, 2012 12:25 PM
Edited by: yurib on Nov 28, 2012 12:25 PM
Edited by: yurib on Nov 28, 2012 12:29 PM

1. The pipe is a meta-character so escape it.
2. Split rolls things up for you unless you tell it otherwise.
String s = "|||A|B|C||||";
String[] array = s.split("[|]", 10);
for(int i=0; i < array.length; i++)
     System.out.println("" + i + ": " + array);

Similar Messages

  • Need to write output to a file in pipe ( | )delimited format

    Hi All,
    I am trying to extract values from a database and write them to a text file with pipe( | ) delimited format. Can someone guide me on this with an example. I ma very much new to Java.
    Thanks for help,
    Abhi

    abhibora wrote:
    Hi All,
    I am trying to extract values from a database and write them to a text file with pipe( | ) delimited format. Can someone guide me on this with an example. I ma very much new to Java.
    Thanks for help,
    AbhiSimply print your values separated by the '|' pipe symbol; I don't see the problem.
    kind regards,
    Jos

  • External Parser - XML to Pipe Delimited - Sql Loader BETTER DBMS_XMLSTORE

    Hi All,
    If I have got data in GIGs in a complex format.
    Can Using an External Java based XML Parser to convert XML to Pipe Delimited FIle and then Using SQL Loader
    BE BETTER THAN
    Using XSL to convert to Oracle <ROWSET> <ROW> Format and using DBMS_XMLSTORE to load data into tables.
    In terms of:
    Performace
    Scalability
    Exception Handling
    Regards....

    Go to the {forum:id=34} forum and look at the second page of the XML DB FAQ Thread (stickied to the top of the posts). While it doesn't compare using external tools to parse XML and load via SQL*Loader, it does talk about better ways to load large amounts of XML into the DB. This is also a good thread on the subject too from that forum, {thread:id=1096784}

  • Pipe Delimited file with comma

    Hi Guys,
    I have a pipe '|' delimited csv file. One of the field contains ',' (comma) for few records. The data loads fine uptill the PSA but when I load the data in the cube, that field is coming empty as well as some other feilds which donot have a comma in it.
    The delmiter in IP and DS is used '|' pipe.

    A pipe within quotes? I don't think you can do that with regex. But you can simply itearate through the chars of the String with an "isInsideQuotes" boolean flag and do a manual replacement using StringBuffer.

  • Help needed in extracting pipe delimited fields in a CLOB data type

    hi
    i Had a table with clob field as shown below.
    CREATE TABLE TRANSACTION_INFO
      TRASACTION_ID  CLOB,
      LOG_ID  NUMBER
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
    Values
       ('354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123);
    Insert into TRANSACTION_INFO
       (TRASACTION_ID, LOG_ID)
    Values
       ('354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456);
    COMMIT;As you can see Clob field is a pipe delimited data.Now i am able to extract the first two fields using the below querry.But it may be the right solution as
    substring function fails if there is missing character in any on the fields.
    Also when there is a null value in any of the fields,how can i be able to get as null value ? Basically i want to get the values in a delimited manner.
    how can we do this ?
    Select Substr (TRASACTION_ID, 1, Instr (TRASACTION_ID, '|')-1) field1,
            Substr (TRASACTION_ID, 17, Instr (TRASACTION_ID, '|')+2) field2              
      From TRANSACTION_INFO;
    output should be like as shown
       FIELD1          FIELD2          FEILD3                 FEILD4
    354502002020910     000000610214609663                  09/27/09 08:02:37
    354599892020910     000000610214609663                  09/27/10 08:12:47Thanks
    Rede

    hi Michael
    Thanks for the solution and its my bad not mention that there is a possibility of having a null value at the start of the record also which RPLACE function no longer works for this case.
    For example
    with transaction_info (trasaction_id, log_id)
         as (
    select '354502002020910|000000610214609663||09/27/09 08:02:37|RNEW|DC25|MOTOROLA|8802939198', 123 from dual union all
    select '354599892020910|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual union all
    select '|000000610214609663||09/27/10 08:12:47|SOLD|DC23||8802939198', 456 from dual
    select trim(regexp_substr (trasaction_id, '[^|]+', 1, 1)) f1,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 2)) f2,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 3)) f3,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 4)) f4,
           trim(regexp_substr (trasaction_id, '[^|]+', 1, 5)) f5
      from (select replace (trasaction_id, '||', '| |') trasaction_id from transaction_info)
    F1                   F2                   F3                   F4                   F5                 
    354502002020910      000000610214609663                        09/27/09 08:02:37    RNEW               
    354599892020910      000000610214609663                        09/27/10 08:12:47    SOLD  
    000000610214609663                        09/27/10 08:12:47    SOLD Now the last record is wrongly created....

  • Pipe delimited file on application server.

    Hi , i m creating a text file on application server, i have written below code and file is getting created correctly.  however, i want to create pipe delimited file.  is there any method for this?
    DATA : lv_line(173).
      DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
      IF NOT p_tab[] IS INITIAL.
        SORT p_tab.
        OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
        IF sy-subrc NE 0.
          MESSAGE 'Error on output file read' TYPE 'E'.
        ELSE.
          LOOP AT p_tab.
            lv_line = p_tab.
            TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
            CLEAR p_tab.
            CLEAR lv_line.
          ENDLOOP.
          CLOSE DATASET p_file.
        ENDIF.
      ENDIF.
      REFRESH p_tab.

    i m pasting below my entire code.
    REPORT  zmigration_data_download.
    FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
    DATA: d_table_ref TYPE REF TO data.
    DATA: d_rfc_db_opt TYPE rfc_db_opt.
    DATA: it_opt LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE.
    DATA: d_file  TYPE string.
    PARAMETERS:     p_tab   TYPE dd02l-tabname OBLIGATORY.
    PARAMETERS:     p_file  LIKE rlgrap-filename OBLIGATORY DEFAULT '/usr/sap/tmp/test.txt'.
    SELECT-OPTIONS: s_opt   FOR  d_rfc_db_opt NO INTERVALS.
    START-OF-SELECTION.
      REFRESH it_opt.
      LOOP AT s_opt WHERE sign = 'I' OR option = 'EQ'.
        it_opt-text = s_opt-low.
        APPEND it_opt.
      ENDLOOP.
      CREATE DATA d_table_ref TYPE TABLE OF (p_tab).
      UNASSIGN <fs_table>.
      ASSIGN d_table_ref->* TO <fs_table>.
      IF <fs_table> IS ASSIGNED.
        CLEAR <fs_table>.
        SELECT * FROM (p_tab) INTO TABLE <fs_table>
        WHERE (it_opt).
        IF sy-subrc EQ 0.
          PERFORM download_file TABLES <fs_table> USING p_file.
          MESSAGE i398(00) WITH 'Upload from SAP Successfull'.
        ENDIF.
      ENDIF.
    *&      Form  download_file
          text
         -->P_<FS_TABLE>  text
         -->P_P_FILE  text
    FORM download_file TABLES p_tab USING p_file.
      DATA : lv_line(173).
      DATA : l_wa_itab_length(4) TYPE c VALUE '173'.
      IF NOT p_tab[] IS INITIAL.
        SORT p_tab.
        OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING NON-UNICODE.
        IF sy-subrc NE 0.
          MESSAGE 'Error on output file read' TYPE 'E'.
        ELSE.
          LOOP AT p_tab.
            lv_line = p_tab.
            TRANSFER lv_line TO p_file LENGTH l_wa_itab_length.
            CLEAR p_tab.
            CLEAR lv_line.
          ENDLOOP.
          CLOSE DATASET p_file.
        ENDIF.
      ENDIF.
      REFRESH p_tab.
    ENDFORM.                               " download_file

  • Need file on Application server to be pipe delimited

    Hi,
    I want the file in the application server with headings and pipe delimited... I have used
        IF NOT T_OUTPUT[] IS INITIAL.
    Transfer the changed T_INPUTFILE data to application server.
          OPEN DATASET V_FILEPATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
                                                  MESSAGE V_MSG.
          IF SY-SUBRC <> 0.
            MESSAGE I008. " File could not be opened.
            EXIT.
          ENDIF.
    Transferring Data
          LOOP AT T_OUTPUT.
            TRANSFER T_OUTPUT TO V_FILEPATH.
          ENDLOOP.
          CLOSE DATASET V_FILEPATH.
        ENDIF.
    But this is not giving me output like below...
    RefDoc.No.
    Text
    Period
    Year
    9
    Dummy Text
    002
    2006
    How do I get a pipe delimited file on the application server ... ??

    Hi,
    Check this..
    DATA: V_STRING TYPE STRING.
    LOOP AT T_OUTPUT.
    DO.
    ASSIGN COMPONENT SY-INDEX OF STRUCTURE T_OUTPUT TO <FS>.
    IF SY-SUBRC <> 0 .EXIT .ENDIF.
    IF SY-INDEX = 1.
       V_STRING = <FS>.
    ELSE.
       CONCATENATE V_STRING '|' <FS> INTO V_STRING.
    ENDIF.
    ENDDO.
    TRANSFER V_STRING TO V_FILEPATH.
    ENDLOOP.
    Thanks,
    Naren

  • Need a pipe delimiter after every field in the file on application server

    Hi ,
    i have to transport data in internal table to a file on application server.
    I have done this successfully. But the problem is i have to put a pipe
    delimiter after every field in the file on application server.
    Could yoe plz help in  this issue.
    Thanks & Regards
    Suresh kumar D

    Hi Should,
              I think the below code should solve your problem as i also had  a similar type of requirement and this was the code i had used in my program.
      FIELD-SYMBOLS: <FS> TYPE ANY.
      DATA: L_FLINE TYPE STRING.
    Open file for output
      M_CHECK_SELSCR_FNMS O1 O.
      LOOP AT I_TARGET.
    Write records to file
        DO.
          ASSIGN COMPONENT SY-INDEX OF STRUCTURE I_TARGET TO <FS>.
          IF SY-SUBRC EQ 0.
            IF SY-INDEX EQ 1.
              MOVE <FS> TO L_FLINE.
            ELSEIF <FS> NE C_PIPE.
              CONCATENATE L_FLINE C_PIPE <FS> INTO L_FLINE.
            ELSE.
              CONCATENATE L_FLINE <FS> INTO L_FLINE.
            ENDIF.
          ELSE.
            TRANSFER L_FLINE TO W_SRVR_NM_O_O1.
            EXIT.
          ENDIF.
        ENDDO.
      ENDLOOP.
    Close file
      CLOSE DATASET W_SRVR_NM_O_O1.
      IF SY-SUBRC EQ 0.
        MESSAGE S208(00) WITH TEXT-M02.
      ENDIF.
    Regards
    Sikha

  • What is the best, most efficient way to read a .xls File and create a pipe-delimited .csv File?

    What is the best and most efficient way to read a .xls File and create a pipe-delimited .csv File?
    Thanks in advance for your review and am hopeful for a reply.
    ITBobbyP85

    You should have no trouble doing this in SSIS. Simply add a data flow with connection managers to an existing .xls file (excel connection manager) and a new .csv file (flat file). Add a source to the xls and destination to the csv, and set the destination
    csv parameter "delay validation" to true. Use an expression to define the name of the new .csv file.
    In the flat file connection manager, set the column delimiter to the pipe character.

  • File content conversion for Pipe delimited file

    Hi
    i have a scenario ( file-xi-proxy) in whch file is coming in a pipe delimited.
    my data type is like
    DT_ XXXXX
    AwardInfo
    Header contains some fileds
    DetailRecord contains some fileds
    trailer contains some fields
    what are content conversion parameters i have to use
    venkat

    Sedamkar,
    Expecting you have one header, multiple details and one trailer then give recordset structure in sender file communication channel as:
    Header,1,DetailRecord ,*,trailer,1
    In content conversion you should give parameters:
    Header.fieldSeparator : |
    Header.endSeparator : 'nl'
    DetailRecord.fieldSeparator : |
    DetailRecord.endSeparator : 'nl'
    trailer.fieldSeparator : |
    trailer.endSeparator : 'nl'
    You may need to change the parameters also according to your strcuture and the file layout. See this SAP help for file content conversion:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
    Regards,
    ---Satish

  • How to create schema for Header and Footer with pipe delimiter file BPEL11g

    Hi all,
    I have issule creating Schema for Header and Footer with body file .The file format is Pipe delimiter.The following format below like is...
    Softeware Components:File Adapter(Read) 11g,
    1|1211|000|577|5444
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|0000|57|6988|4554|sfdgh|5448|3333|ituu|44445|55546|544|788|7788
    1|4544|000|yted
    I hope get the sollution for this from this Forum..Please help me out..Thankyou.

    You mean how many rows or columns..?
    If coloumns means 5 and rows only one(1).

  • How to create Schema Header and footer with Pipe delimiter file..?

    Hi all,
    I have issue with creating Schema Header and footer with body file ..The file format is Pipe delimiter.. The follwing file below like is...
    Adapters:File Adapter(Read)-11g.
    1|000|2025|SDFG|54787
    1|2055|244|9566|000|000|044|2577|361147|45554|wweqw|52555|564|000|647|464
    1|2027|344|4566|000|000|044|8577|361147|45554|wweqw|82555|564|000|647|844
    1|2024|444|6566|000|000|044|9577|361147|45554|wweqw|12555|564|000|647|544
    1|2023|544|8566|000|000|044|5577|361147|45554|wweqw|52555|564|000|647|442
    1|2022|644|3566|000|000|044|7577|361147|45554|wweqw|02555|564|000|647|448
    1|0000|546|25544|454
    If you have sollution for this, please help me out..Thank you.

    You mean how many rows or columns..?
    If coloumns means 5 and rows only one(1).

  • Extract data from Pipe Delimited file

    Hi everybody,
    Could someone provide me the command to extract data from a pipe delimited file ("|") using Open/Read Data set.
    I mean eliminating the delimiter ("|") and just picking the data.
    Thanks
    M

    Here you go.. this code snippet parses the input file record by using pipe (variable lv_pipe) as separator, for tab separated file you can use lv_tab like wise...
      TYPES: BEGIN OF ts_field,
               field(50) TYPE c,
             END OF ts_field,
             tt_field TYPE TABLE OF ts_field.
       DATA: ls_record TYPE string,
            ls_input_data TYPE ts_input_data,
            lv_tab TYPE x VALUE '09',
            lv_pipe TYPE C VALUE '|',
            ls_field TYPE ts_field,
            lt_field_tab TYPE tt_field,
            lv_field_index TYPE syindex,
            lv_record_no TYPE syindex.
      FIELD-SYMBOLS: <fs_field> TYPE ANY.
      OPEN DATASET fv_file_path IN TEXT MODE FOR INPUT.
      IF sy-subrc = 0.
        DO.
          lv_record_no = lv_record_no + 1.
          READ DATASET fv_file_path INTO ls_record.
          IF sy-subrc NE 0.
            EXIT.
          ELSE.
            SPLIT ls_record  AT lv_pipe INTO TABLE lt_field_tab.
            CLEAR: lv_field_index, ls_input_data.
            LOOP AT lt_field_tab INTO ls_field.
              lv_field_index = lv_field_index + 1.
              ASSIGN COMPONENT lv_field_index OF STRUCTURE
                ls_input_data TO <fs_field>.
              IF sy-subrc = 0.
                <fs_field> = ls_field-field.
              ENDIF.
            ENDLOOP.
            APPEND ls_input_data TO ft_input_data.
          ENDIF.
        ENDDO.
        CLOSE DATASET fv_file_path.

  • READ THE PIPE DELIMITER FILE

    Hi guys,
    I am uploading the data from a file which is in the application server and in pipe delimiter format.
    This file in the format like .... let us take 100 records among those one record is header,  98 data records and one trailer record. These are seperated by the record locater like header with 0, data record with 1 and trailer with 9.
    So what i am doing is uploading that file first of all into one internal table I_ARFILE, then splitting the data at pipe into 3 different internal tables. In the mean time I am doing the validations also for the number of records...
    like there should not be more than one header, and one trailer........
    here I am pasting my code.....
      IF l_subrc = 0.
        LOOP AT I_ARFILE.
        READ TABLE I_ARFILE INTO WA_ARFILE.
          SPLIT WA_ARFILE AT C_PIPE INTO WA_ARHEADER-P_RECTYPE
                                        WA_ARHEADER-P_PRCID
                                        WA_ARHEADER-P_SENDR
                                        WA_ARHEADER-P_CDATE
                                        WA_ARHEADER-P_CTIME
                                        WA_ARHEADER-P_OBTYP
                                        WA_ARHEADER-P_SEQNO
                                        WA_ARHEADER-P_FRTXT.
          IF WA_ARHEADER-P_RECTYPE = 0.
            APPEND WA_ARHEADER TO I_ARHEADER.
            DESCRIBE TABLE I_ARHEADER LINES V_ITABLINES.
    VALIDATION FOR NUMBER OF HEADER RECORDS
            IF V_ITABLINES <> 1.
              MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
              LEAVE PROGRAM.
            ENDIF.
            CLEAR V_ITABLINES.
          ELSE.
            SPLIT I_ARFILE AT C_PIPE
                                 INTO WA_ARITEM-P_RECTYPE
                                      WA_ARITEM-p_xblnr
                                      WA_ARITEM-p_bldat
                                      WA_ARITEM-p_budat
                                      WA_ARITEM-p_blart
                                      WA_ARITEM-p_awkey
                                      WA_ARITEM-p_kunnr
                                      WA_ARITEM-p_xref1
                                      WA_ARITEM-p_xref2
                                      WA_ARITEM-p_xref3
                                      WA_ARITEM-p_wrbtr
                                      WA_ARITEM-p_zterm
                                      WA_ARITEM-p_zuonr
                                      WA_ARITEM-p_rstgr
                                      WA_ARITEM-p_wskto
                                      WA_ARITEM-p_sgtxt.
            IF WA_ARITEM-P_RECTYPE = 1.
              APPEND WA_ARITEM TO I_ARITEM.
        ENDIF.
    VALIDAITON FOR THE NUMBER OF DATA RECORDS.
              DESCRIBE TABLE I_ARITEM LINES V_ITABLINES.
              DESCRIBE TABLE I_ARFILE LINES V_ITABLINES1.
              V_ITABLINES1 = V_ITABLINES1 - 2.
              IF V_ITABLINES1 <> V_ITABLINES.
                MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
                LEAVE PROGRAM.
              ENDIF.
            LOOP AT I_ARITEM.
            V_BAL1 = V_BAL1 + I_ARITEM-P_WRBTR.
            V_DIS = V_DIS + I_ARITEM-P_WSKTO.
            ENDLOOP.
    CHECKING THE SUM OF THE BALANCE AMOUNT OF ALL THE RECORDS AND BALANCE AMOUNT IN TRAILER RECORD
            IF V_BAL1 <> WA_ARTRAILER-TOBAL.
               MESSAGE 'TOTAL AMOUNT IS NOT EQUAL TO THE SUM OF ALL THE AMOUNTS' TYPE 'E'.
            ELSE.
    CHECKING THE SUM OF THE DISCOUNT AMOUNT OF ALL THE RECORDS AND BALANCE AMOUNT IN TRAILER RECORD
            IF V_DIS <> WA_ARTRAILER-TODIS.
               MESSAGE 'TOTAL DISCOUNT AMOUNT IS NOT EQUAL TO THE SUM OF ALL THE DISCOUNT AMOUNTS' TYPE 'E'.
            ENDIF.
            CLEAR V_BAL1.
           APPEND WA_ARITEM TO  I_ARITEM.
              CLEAR WA_ARITEM.
           CLEAR WA_ARFILE.
              CLEAR V_ITABLINES.
              CLEAR V_ITABLINES1.
         ENDIF.
       ENDLOOP.
      ENDLOOP.
    ENDIF.
            ELSE.
    READ TABLE I_ARFILE INTO WA_ARFILE INDEX V_ITABLINES.
              SPLIT WA_ARFILE AT C_PIPE INTO WA_ARTRAILER-P_RECTYPE
                                               WA_ARTRAILER-COUNT
                                               WA_ARTRAILER-TOBAL
                                               WA_ARTRAILER-TODIS.
              IF WA_ARTRAILER-P_RECTYPE = 9.
                APPEND WA_ARTRAILER TO I_ARTRAILER.
              ENDIF.
              DESCRIBE TABLE I_ARTRAILER LINES V_ITABLINES.
              IF V_ITABLINES <> 1.
                MESSAGE 'NUMBER OF LINES READ ARE NOT SAME' TYPE 'E'.
                LEAVE PROGRAM.
              ENDIF.
       CLEAR WA_ARFILE.
              CLEAR V_ITABLINES.
            ENDIF.
    *CLEAR WA_ARFILE.
            CLEAR V_ITABLINES.
            CLEAR V_ITABLINES1.
          ENDIF.
        ENDLOOP.
    In this code something wrong like....
    I have to modify this code so that i can split the file based on the record indicator to different internal tables.
    if you see my code I am going wrong after i split the data into header internal table... did the validations then I put the else condition and split the same record again into 2nd internal table. But I have to take the second record once the first one is filled..........
    Can any one guide me how to do that plz...... I am bit confused with this
    SRI

    Hi,
    Please check , first you need to split the file and move header, item, trailer , then using these internal tables do your validations
    DESCRIBE TABLE I_ARFILE LINES V_LIN
    READ TABLE I_ARFILE INTO WA_ARFILE INDEX 1.
    IF SY-SUBRC EQ 0.
    SPLIT WA_ARFILE AT C_PIPE INTO WA_ARHEADER-P_RECTYPE
    WA_ARHEADER-P_PRCID
    WA_ARHEADER-P_SENDR
    WA_ARHEADER-P_CDATE
    WA_ARHEADER-P_CTIME
    WA_ARHEADER-P_OBTYP
    WA_ARHEADER-P_SEQNO
    WA_ARHEADER-P_FRTXT.
    APPEND WA_ARHEADER TO I_HEADER.
    ENDIF.
    READ TABLE I_ARFILE INTO WA_ARFILE INDEX v_LIN.
    IF SY-SUBRC EQ 0.
    SPLIT WA_ARFILE AT C_PIPE INTO WA_ARTRAILER-P_RECTYPE
    WA_ARTRAILER-COUNT
    WA_ARTRAILER-TOBAL
    WA_ARTRAILER-TODIS.
    APPEND WA_ARTRAILER TO I_TRAILER.
    ENDIF.
    * FIRST DELETE TRAILER THEN GO FOR HEADER
    READ TABLE I_ARFILE INTO WA_ARFILE INDEX V_LIN.
    DELETE I_ARFILE INDEX SY-TABIX
    READ TABLE I_ARFILE INTO WA_ARFILE INDEX 1.
    DELETE I_ARFILE INDEX SY-TABIX.
    LOOP AT I_ARFILE INTO WA_ARFILE.
    SPLIT I_ARFILE AT C_PIPE
    INTO WA_ARITEM-P_RECTYPE
    WA_ARITEM-p_xblnr
    WA_ARITEM-p_bldat
    WA_ARITEM-p_budat
    WA_ARITEM-p_blart
    WA_ARITEM-p_awkey
    WA_ARITEM-p_kunnr
    WA_ARITEM-p_xref1
    WA_ARITEM-p_xref2
    WA_ARITEM-p_xref3
    WA_ARITEM-p_wrbtr
    WA_ARITEM-p_zterm
    WA_ARITEM-p_zuonr
    WA_ARITEM-p_rstgr
    WA_ARITEM-p_wskto
    WA_ARITEM-p_sgtxt.
    APPEND WA_ARITEM TO I_ITEM.
    ENDLOOP.
    aRs

  • Converting sed regex to Java regex

    I am new to reguler expressions.I have to write a regex which will do some replacements
    If the input string is something like test:[email protected];value=abcd
    when I apply the regex on it,this string should be changed to test:[email protected];value=replacedABC
    I am trying to replace test.com and abcd with the values i have supplied...
    The regex I have come up with is in sed
    s/\(^.*@\)\(.*\)$/\1replaceTest.com;value=replacedABC/i
    Now I am trying to get the regex in Java,I would think it will be something like (^.*@\)(.*\)$\1replaceTest.com;value=replacedABC
    But not sure How i can test this.Any idea on how to make sure my java regex is valid and does the required replacements?

    rsv-us wrote:
    Yep.Agreed.
    Since that these replacements should be done in a single regex.Note that the sed replacement I posted is really made of two replacements! Just like your Java solution would.
    I think once we send this regex to the third party,they will haev to use either sed or perl(will perl do this replacements,not sure though) to get the output.
    Since we are not sure what tool/software the third party is going to use,I was trying to see how i can really test this.Then I read about sed and this regex as is didn't work,so,I had to put all the sed required / and then the regex had become like s/\(^.*@\)\(.*\)$"/1replaceTest.com;value=replacedabcd/iAgain: AFAIK that does not work. I tried it like this:
    {code}$ echo test:[email protected];value=abcd | sed 's/\(^.*@\)\(.*\)$"/1replaceTest.com;value=replacedabcd/i'and the following is returned:test:[email protected] that we will have to send the java regex to the third party,I was trying to see how i can convert this sed regex to java.If I am right,with jave regex,we won;t be able to all the finds and replacements in a single regex..right?...If this is true,this will leave me a question of whether I need to send the sed regex to the thrid party or If I send java regex,they have to convert that to either sed or perl regex.
    One more question,can we do thse replacement in perrl also,if so,what will the equivalent regex for this in perl?
    I can't understand what you are talking about. The large amount of spelling errors also doesn't help to make it clearer.
    Good luck though.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • I can't get Mozilla Drag and Drop Uploader to work. Suggestions for troubleshooting?

    I have a recurring need to post 100's of photos from "My Pictures" to a web site. I currently click on "Browse", up pops the photo file, and I then must manually select the proper photos and double click them to move them to the web site. A colleague

  • Seeburger Adpater for PI with EhP

    Hi, Does anyone know whats the correct Seeburger version or the CD set number (for example: 51038606 & 51038611) for PI 7.1 with EhP 1 SPS 05? I'm unable to open the OSS Note 890721, to check the right version or CD set number for Seeburger adapter f

  • Throws an error OnCreatMainForm, Need Help.

    The Error it self: An unhandled exception of type 'System.InvalidOperationException' occurred in AS-Design.exe Additional information: An error occurred creating the form. See Exception.InnerException for details.  The error is: The form referred to 

  • MW600 first hang until battery ends within 7 days

    Hi I have purchased a new MW600 wireless head phone from Amazon UK (I am in London) and it has hanged first time within 7 days of working. It was hangcompletely and it was showing full battery icon and buletooth icon only. I can not restart it any wa

  • BSP Url encoding

    Hi all! I'd like to use URL encoding (I guess base64) to mask url parameters in our URL (instead of default.htm?param1=value&param2=value etc.) to prevent URL manipulation. In most parts of our application we use PopUp-Windows without the location ba