Release Automation

  • 1.  Regular Expression to Spilt a String

    Posted Aug 09, 2017 06:01 PM

    Hi, 

     

    Can someone help me to write a regular expression to split below string, into 4 values

     

    \\ndashst1.test.att.com\e$\wwwroot\icecap-appboard-lob-plugins\art\js E:\wwwroot\icecap-appboard-lob-plugins\art\js artInventorySelectFactory.js null

     

    1. \\ndashst1.test.att.com\e$\wwwroot\icecap-appboard-lob-plugins\art\js

    2. E:\wwwroot\icecap-appboard-lob-plugins\art\js

    3. artInventorySelectFactory.js

    4. null

     



  • 2.  Re: Regular Expression to Spilt a String
    Best Answer

    Posted Aug 10, 2017 01:40 AM

    Hi,

     

    is it guaranteed that your separator is a blank? does it have to be a regular expression?

     

    because if you only want to split the string to get the elements, you're better off simply using a javascript action and do something like that:

     

    arrOutput1 = input1.split(" ")

     

    with input1 being your long string from which you want to extract the part

     

    best regards

    Michael



  • 3.  Re: Regular Expression to Spilt a String

    Broadcom Employee
    Posted Aug 10, 2017 10:23 AM

    You might also want to have a look at the field developed utilities action pack. One of its actions are:

    - Strings - Split into Array

     

    It can be found here: 

    CA Field Utilities Action Pack 

     

    Cheers,

    Gregg



  • 4.  Re: Regular Expression to Spilt a String

    Posted Aug 14, 2017 11:57 PM

    Hi Gregg,

     

    I need again help on creating the regEX for below string. I tried Java Script code, string action with regular expression but not getting solution.

     

    my input string will be like this, user will copy this from Excel sheet directly and paste in String variable. I want to split this string into 4 element of array.

     

    \\Hostname\Source\icecap-appboard-lob-plugins\art\js C:\wwwroot\icecap-appboard-lob-plugins\art\js artInventorySelectFactory.js null null
    \\Hostname\Source\icecap-appboard\assets\images\vectors C:\wwwroot\icecap-appboard\assets\images\vectors * Web.config null
    \\Hostname\Source\icecap-appboard-lob-plugins\art\views C:\wwwroot\icecap-appboard-lob-plugins\art\views\ * Web.config logs
    \\Hostname\Source\icecap-appboard-lob-plugins\art\views C:\wwwroot\icecap-appboard-lob-plugins\art\views\ artSearchCriteria.html null null
    \\Hostname\Source\icecap-appboard-lob-plugins\art\views\ C:\wwwroot\icecap-appboard-lob-plugins\art\views\ order-submission.html null null

     

    Excel format is like this,

     



  • 5.  Re: Regular Expression to Spilt a String

    Posted Aug 16, 2017 02:08 AM

    Hi,

     

    isn't this the exact same thing, that is already answered? you even marked my answer as correct yourself.

     

    I still don't understand why you're so focused on using a regular expression.

     

    The thing that might happen, if you copy it directly from Excel, is that your split becomes a tab instead of a space. but I'm not sure.

     

    On a site note, I probably would have solved this by writing a powershell script that reads the excel file directly instead of letting the user copy&paste each line

     

    best regards

    Michael