2 Replies Latest reply: Aug 29, 2013 12:43 AM by EJP RSS

    split and find the real delimeter

    FouadAzem

      Hi,


      i have some long string.


      String str=key\\++value;ke\\;y\\+key+value;key\\+key+value\\;value;key+value


      first i have to split base on ';' and not base on \\;

      and get the following:

      key\\++value

      ke\\;y\\+key+value

      key\\+key+value\\;value

      key+value


      then i need to split base on + and not base on \\+
      key                  value

      key\\+              value

      ke\\;y\\+key     value

      key\\+key        value\\;value

      key                 value


      please advice how i should do that and which regular expression i need to use or not use but split base on above manner.

      Thanks.

        • 1. Re: split and find the real delimeter
          rp0428

          i have some long string. 


          String str=key\\++value;ke\\;y\\+key+value;key\\+key+value\\;value;key+value

          Why are you basically just ignoring the advice you got in your other thread about how to properly create delimited strings?

          https://forums.oracle.com/thread/2569685

           

          You were told there the requirements that you needed to follow to handle embedded delimiters and the rules you need to use to parse such strings. This is what you just said above:

          first i have to split base on ';' and not base on \\;

          then i need to split base on + and not base on \\+

          That is NOT what you were told in your other thread. What I said there is still true whether you choose to believe it or not:

          THERE ARE NO SHORTCUTS! You either have to do it right or be willing to suffer the consequences.

          • 2. Re: split and find the real delimeter
            EJP

            Moderator action: Duplicate of your other thread. Locking.