Skip to main content
LoganPrice
Most Valuable Pathfinder
Most Valuable Pathfinder
August 2, 2022
Question

"$" Dollar Sign Not Allowed in A360?

  • August 2, 2022
  • 6 replies
  • 2571 views

Why do I get the following "Invalid Expression" when using the "$" symbol for regex end of line? This is a very common and basic regex functionality. Am I doing something wrong?imageThanks

    6 replies

    Ashwin A.K
    Navigator | Tier 3
    August 2, 2022

    Hi @Logan Price​ ,

     

    Could you let us know what exactly it is that you want to replace, and with what?

     

    Kind Regards,

    Ashwin A.K

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    LoganPrice
    Most Valuable Pathfinder
    Most Valuable Pathfinder
    August 2, 2022

    Thanks, that is exactly what I needed! Also, your original comment that explained that a $$ is needed to escape the character is also true so I marked that as the best answer.

    Automate Everything
    Ashwin A.K
    Navigator | Tier 3
    August 2, 2022

    Hi @Logan Price​ 

     

    I had a feeling that this is what you were trying to achieve.

     

    If that is the case, then you have to understand that the String: Replace Action replaces the matched item, which means you have to match those items that you don't want in your string.

     

    Here is a pattern that does just that:

    .*\\

     

    image 

    Kind Regards,

    Ashwin A.K

     

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Ashwin A.K
    Navigator | Tier 3
    August 2, 2022

    Hi @Logan Price​ ,

     

    When you add a Dollar sign, Automation Anywhere thinks you are trying to reference a variable.

    If you want Automation Anywhere to treat a dollar sign as a dollar sign then you have to escape it with another dollar sign like so:

     

    ([^(\\|\/)]+$$)

     

    Could you give that a try and let us know if it works out for you?

     

    Kind Regards,

    Ashwin A.K

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    LoganPrice
    Most Valuable Pathfinder
    Most Valuable Pathfinder
    August 2, 2022

    Sure. Let's say that the $AATaskNAme$ gives the following string:

     

    \Bots\Sample1\Sample2\Sample3\Sample4\Match_This_String

     

    I want to isolate "Match_This_String".

     

    My strategy for doing so is to match every character after the final slash ("\" or "/").

     

    The result of my Regex should be a string variable containing only:

     

    "Match_This_String

    Automate Everything
    LoganPrice
    Most Valuable Pathfinder
    Most Valuable Pathfinder
    August 2, 2022

    I get the following error:image

    Automate Everything