1 Reply Latest reply on Jan 20, 2020 11:55 AM by Frank Kulash

    Regular Expression and Random Chars string

    3219506

      Hello Team,

       

      I have a CLOB column in a table which could contain multiple lines of data or a paragraph of data as below. We have to treat each line and change each word into random characters as below.

       

                                         Before                                                                                                                                            After

      --------------------------------------------------------------------------------------------                                                   -----------------------------------------------------------------------------

       

      He is a boy.                                                                                                                                               Pt ot s yus.

      His name is Rama.                                                                                                                                   Skl eypt es awkt.

       

       

      This is dummy data. Any value can be inserted.No guarantee of                                                           dfsd io pofty gher. pio lopuy rty .............(random characters)

      values.

      (This is a paragraph with only 1 enter.)

       

       

      Every word should be of equal length of word in input lines.

       

      Please help me with an idea how to implement it.

        • 1. Re: Regular Expression and Random Chars string
          Adityanath Dewoolkar

          I am not this if below is your requirement.

           

          SELECT comments,translate(lower(comments),'abcdefghijklmnopqrstuvwxyz','qwertyuiopasdfghjklzxcvbnm' ) as DUMMY FROM test1;

           

          1100.JPG

          Regards,

          Adi

          • 2. Re: Regular Expression and Random Chars string
            BluShadow

            *** Moderator Note: Moved to SQL and PL/SQL space as the "DBA/DEV Community Corner" space is not the appropriate place to ask technical/product questions.

            • 3. Re: Regular Expression and Random Chars string
              Frank Kulash

              Hi,

              3219506 wrote:

               

              Hello Team,

               

              I have a CLOB column in a table which could contain multiple lines of data or a paragraph of data as below. We have to treat each line and change each word into random characters as below.

               

              Before After

              -------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------

               

              He is a boy. Pt ot s yus.

              His name is Rama. Skl eypt es awkt.

               

               

              This is dummy data. Any value can be inserted.No guarantee of dfsd io pofty gher. pio lopuy rty .............(random characters)

              values.

              (This is a paragraph with only 1 enter.)

               

               

              Every word should be of equal length of word in input lines.

               

              Please help me with an idea how to implement it.

               

              Do you really need random characters. like 'Pt ot s yus'?  Why not 'Aa aa a aaa'?  TRANSLATE can do the latter.

              In 'His name is Rama', does the capital 'H' need to be replaced by a capital letter, but the captial 'R' must not be?  Explain the rules.

              In the examples you posted, spaces and periods are preserved.  What other characters will NOT be changed.  Numerals?  Other punctuation?  Others symbols, like '~' and '/'?