how to extract the id's from the text

Certified Senior Developer

hi team,

testing the emailid's,1234567-45 testing 1234567-9ow2 doing 12 34 567- 2 2 test 12/34,567:- 2.2 tests 12345an67-92 dummy 12345-23 

have to extract the id's and after extracting need to format in below format,

12345-05,

123456-06

1234567-07

could you please suggest best approch.

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Senior Developer
    in reply to Harsha Sharma

    hi  , In the email will get the input like "testing the emailid's,1234567-45 testing 1234567-9ow2 doing 12 34 567- 2 2 test 12/34,567:- 2.2 tests 12345an67-92 dummy 12345-23 "

    need to extract the ID's from text after extracting id's then we have to truncate the spaces /alpha letters/special characters then need to format below .

    12345-05,

    123456-06

    1234567-07

  • 0
    Certified Lead Developer
    in reply to sureshs276515

    Your text will be this after removing special characters and alphabets. "1234567-45 1234567-92 12 34 567- 2 2 1234567- 22 1234567-92 12345-23" 
    Still not sure on what basis 12345-05, 123456-06, 1234567-07 series will come along. 
    Give this code a try as a starter and then apply logic to get the desired series. The output format/logic is unclear to me, so I will leave it till this for you. 

    a!localVariables(
      local!text: "testing the emailid's,1234567-45 testing 1234567-9ow2 doing 12 34 567- 2 2 test 12/34,567:- 2.2 tests 12345an67-92 dummy 12345-23",
      reject(
        fn!isnull,
        split(
          stripwith(
            local!text,
            "abcdefghijklmnopqrstuvwxyz!@#$%^&*();',./<>?:"
          ),
          " "
        )
      )
    )