Split string help

  • 7 August 2019
  • 4 replies
  • 44 views

Badge +4

Hi ,

 Building a string from two reqular expression collections .

collection1 : A;B;C  (last ; elimated using buildstring)

collection2 :Apple;Banana;Carrot

Building string

The string looks like

A;B;C|Apple,Banana,Carrot

I need to split  A and Apple

                       B and Banana

                        C and Carrot

 

How it is possible through regular expression or any other way ?

Thanks in Advance

 


4 replies

Userlevel 6
Badge +22
Hi,
To help resolve this please advise what sort of output are you looking for? What would lit look like? For example would it be A;Apple,B;Banana,C;Carrot
Or would it be separate string pairs etc?
Badge +4

Hi simon ,,thanks for your response .

 

Actually what I need here is  , I have a below Json string ...

 

{
  "result": [
    {
      "website": "Google",
      "url": "https://www.google.com"
     
    },
    {
      "website": "Nintex",
      "url": "https://www.nintex.com"
    
    },
    {
      "website": "Microsoft",
      "url": "https://www.microsoft.com"
     
    }
  ]
}

 

Using reqular express pattern I am able to get website values and stored them into a Collection variable called collWeb . Collection is  Google;Nintex;Microsoft

 

second regular expression pattern I am to get all URL values and stored then into another collection variable called collURL  . Collection is https://www.google.com;https://www.nintex.com;https://www.microsoft.com

 

Using Build string I am concating two above variables with | sepreated .So the whole string will be

 

Google;Nintex;Microsoft|https://www.google.com;https://www.nintex.com;https://www.microsoft.com

 

I need out put like

Google and https://www.google.com

Nintex and https://www.nintex.com

Microsoft and https://www.microsoft.com

 

So that I will form a link ...

Userlevel 6
Badge +22

Hi,

I have attached a workflow which outputs what you want in one long string separated by a semi colon.

Google and https://www.google.com;Nintex and https://www.nintex.com;Microsoft and https://www.microsoft.com;

 

I created the collections at the start of the workflow to simulate what you get when you do your query.  I dont recommend joing the two collections as you have but instead just grab what you need out of them.

 

If I miss understood what you were after let me know and I can have another go at it.

 

Badge +4
Thanks a lot Simon . Worked perfectly ...

Reply