Skip to main content

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

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


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.


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

 


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


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


I get the following error:image


Reply