cancel
Showing results for 
Search instead for 
Did you mean: 

regex

lulis
Level 3

How can I apply regex to a variable, so then I can store that result in another variable?



------------------------------
Lucia Lisdero
------------------------------
4 REPLIES 4

AyushSingh2
Level 2

You can use the calculation stage to perform your regex operation and store that result in different variable.



------------------------------
Ayush Singh
------------------------------

LeonardoSQueiroz
Level 10
Hello Lucia,
 
You can use the Utility - Strings VBO and the Extract Regex Values action to obtain a regex expression from a string;
 
You can use this site to test your expressions with examples: https://regex101.com/
 
Regards,



------------------------------
Leonardo Soares
RPA Developer
América/Brazil
------------------------------

Leonardo Soares RPA Developer América/Brazil

faheemsd
Level 6

Dear Lucia

Add Calculate stage: Drag and drop a Calculate stage onto your process diagram.

Configure the stage:

Input: Select the input variable where you want to apply the regex.
Calculation Expression: Define the regex pattern or function to perform the operation.
Output: Specify the output variable where you want to store the result.
Specify the regex pattern:

Use regex functions such as Regex.Match, Regex.Replace, or Regex.Split to perform the desired operation.
Provide the regex pattern within the function parameters.



------------------------------
SYED FAHEEM
RPA Developer
Arab Financial Services
Manama
------------------------------

sonuiiml
Level 5

Hi @lulis
Can you specify the context a little bit more on what you are trying to achieve?
Normally utility Strings solves the purpose.
In this example below it extracts all the numbers from a sample text and puts them into a collection.

14251.png

14252.png

14253.png

Depending on business scenario, the required regex pattern should be used.
Sample regex patterns can be found in the below link 

JavaScript RegExp Reference (w3schools.com)

If you find the answer useful, you can mark as best solution. 
Thanks

14254.png

 



------------------------------
Susamay Halder Consultant
Consultant
Bruce Power
+1(437)217-1086
------------------------------