Release Automation

Expand all | Collapse all

Fetching multiple file names from a text file via RegEx

Jump to Best Answer
  • 1.  Fetching multiple file names from a text file via RegEx

    Posted 04-24-2017 06:02 AM

    Hi Team,

    I have a file with below contents and just need to fetch the file name for further processing.

    Created an action for this requirement in CA RA & it's fetching only one pattern.

    My requirement - Need to fetch all the file names ending with .xsl and store them in a string or string array for further processing.

    Also, adding "Expression Flags" is failing. How can we add expression flags like global & multi-line in CA RA action.

     

    Sample File Name:

    build2/config/appServer/webtop/CustomerInformationXSL.xsl
    build2/config/appServer/webtop/SalesInformationXSL.xsl
    build2/config/appServer/webtop/CustomerInformationXSL.xsl
    build2/config/appServer/webtop/PartnerInformationXSL.xsl
    build2/config/appServer/webtop/SalesInformationXSL.xsl

     

    Requirement:

    Need to only file name like CustomerInformationXSL.xsl, SalesInformationXSL.xsl etc

     

    Below is the Regex patter, with GLOBAL & MULTILINE flags, which works in RegExr console, but not in CA RA action. Currently, it fetches only one pattern.

     



  • 2.  Re: Fetching multiple file names from a text file via RegEx
    Best Answer

    Posted 04-24-2017 08:00 AM


  • 3.  Re: Fetching multiple file names from a text file via RegEx

    Posted 04-24-2017 10:13 AM

    Hi Raghu,

     

    I see that you seem to have found an answer. But based on the description you gave it looks like you were just looking for all xsl filenames. If that is the case you could use the action type named: File Files or Folders. 

     

    This action has both wildcard and regular expression matching as well as an array output for you to store the results. I think this is better than using a "Run Command Line" action to run ls and or ls with grep.

     

    Cheers,
    Gregg



  • 4.  Re: Fetching multiple file names from a text file via RegEx

    Posted 04-24-2017 10:16 AM

    Sure Gregg!

     

    Will give it a shot for this action and let you know. It's always good to use actions that are most appropriate.

     

    Thanks,

    Raghavendra Guttur