Skip to main content

Hi I’m new to automation anywhere , currently leaning its concepts
I have variable CP_ number = JXN-11107-1
I want to extract JXN from this variable
The variable value varies 
There could be JXN-11107-03, ALA-12345-9,  and LOU-45679-8 etc
1. How can I extract only JXN, ALA and LOU from my variable

  1. First i want to write condition if my variable contains JXN, ALA, LOU then it could extract JXN, ALA and LOU from my variable

Kindly help me writing these regular expression and if condition

Hi Aima Arif,

 

Use the find command to JXN, ALA, LOU in the string , you will get the count if value is present if not find it will be 0, and condition to check if its more than 1 then use substring and give start as output you got in find and 3 charcter.

 

If you are aware the three characters will be at start you can directly use substring to extract first 3 Letters 

 

 


Hi @Aima Arif ,

Please find the below,

JXN-11107-03, ALA-12345-9,  and LOU-45679-8

JXN, ALA and LOU

Based on the above example data, you can use the if condition and string package to extract the specific value.

  1. Add the If condition and check the JXN, ALA and LOU string the mentioned characters includes or not
  2. Please add multiple if conditions for each 

Like a below 

 

If JXN is includes then, please use the string package to get the data,

You can 2 actions here

  1. Extract text 
  2. Substring 

Extract Text - you have to mentioned before or after the value to get the data 

Substring - you have to mention the length to extract the data 

 

 

 


Hi @Aima Arif 
To answer your 1st question - You can use String: Extract text or String: Substring based on your need.

If you used Substring then you can provide length like how much character you need to extract

and using extract string you can use before this  “-” sign extract whatever text.

2) Once you extracted  JXN, ALA and LOU then put condition on the same. 

 


Hi @Aima Arif 
To answer your 1st question - You can use String: Extract text or String: Substring based on your need.

If you used Substring then you can provide length like how much character you need to extract

and using extract string you can use before this  “-” sign extract whatever text.

2) Once you extracted  JXN, ALA and LOU then put condition on the same. 

 

Thanks it worked


Reply