Release Automation

Expand all | Collapse all

RegEx Doesn't Work - Need an advice/help!

Jump to Best Answer
  • 1.  RegEx Doesn't Work - Need an advice/help!

    Posted 04-26-2017 01:16 AM

    Hello Members,

     

    I need to extract file from text file located in an UNIX server. As per the need, Regex pattern works well.

     

    [Need to get just file name]

    cat /tmp/edge_custom.txt
    webtop/custom/scope_selection/templates.jsp
    webtop/custom/scope_selection/templates.jsp
    webtop/custom/ajax/ajax_managePresetContent.jsp
    webtop/custom/javascript/stEnablerControl.js
    webtop/custom/scope_selection/dojoDialogs.jsp
    webtop/custom/ajax/ajax_cmcservice.jsp
    webtop/custom/config/emcgs_components.xml
    webtop/custom/javascript/getCustomerInfo.js

     

    But, CA RA is action is failing with below error -

     

     

    Same RegEx pattern works in RegEx validation console. Please see below for relevant results -

     



  • 2.  Re: RegEx Doesn't Work - Need an advice/help!

    Posted 04-27-2017 12:49 AM

    Hi,

     

    can you show the action settings please?

     

    Did you put the "/gm" in the regex in your action as well? if so, this probably won't work. the action itself is already parsing each line of the file with the regex, so there is for example no need to put in the multiline modifier.

     

    best regards

    Michael



  • 3.  Re: RegEx Doesn't Work - Need an advice/help!
    Best Answer

    Posted 04-27-2017 01:49 AM

    Why don't you do something like this which is far easier and faster:

     

    (.*\/)(.*)

     

    Then \2 (the second capture group) will contain the file name.

     

    I suggest you give it a try!



  • 4.  Re: RegEx Doesn't Work - Need an advice/help!

    Posted 04-27-2017 06:10 AM

    Thanks Michael & Christophe! It's helping me a lot.

    Awesome....