REGEX Result in Variable

Hello Automise Team and other !

I’m looking for a way to stock the result of “Text Find / Replace action” with Regex in a variable.
For exemple, i try to find this in one file :

This Regex will find the first line which contain : example. I try in Notepad++ and with the action Text Find / Replace and it’s ok. Automise find the line.

But after, i have no idea how can i stock the result in a variable. I try to make a mix with actions “Read Text File”, Text Find / Replace", or to stock in variable all my text file to try anything with Variable action. Unfortunately, it isn’t a succes.

Version Automise :



You would have to use the script events to achieve this - I have attached and example project that shows this

TextFindExample.atp5 (2.0 KB)

Hi Vincent,

First at all, thank for your answer.

Then, i test and it isn’t exactly the resultat i want. In your exemple, you find the line but in the variable RESULTVAR, i have juste the word “example”. I need to have all the line (the result of the regex).

I continue my research and i find a solution :

  1. I duplicate my file to have 2 same files (FileA / B.txt)
  2. I use the action “Text Find / Replace” in one of them to find my REGEX : ([^\r\n]example[^\r\n]) and Replace by nothing. So i have one file with all information, and one without my regex.
  3. I use a powershell script to compare two file and have the result of the difference :

Set-Location -Path “C:\YOUR\LOCATION”; $filebefore=“.\FileA.txt”; $file_after=“.\FileB.txt”
Compare-Object -PassThru -ReferenceObject (Get-Content $filebefore) -DifferenceObject (Get-Content $file_after) | Out-File “.\NoMatch.txt” -Append
4) I read NoMatch.txt and i have the result of ma research with the REGEX.

I’m not sure it’s the most efficiency but it’s working so i share for other.

Regex is so powerfull in automation. It’s a pity Automise can’t stock the result of the REGEX search. But anyway, i love this Tools !! So easy to automate a production environnement.

Thank for your help,


I just used the regex you provided in the example.

If you change the regex to


it will give you the whole line.

Hello Vincent,

My Bad, You are right !! So easylier.

But i need to understand how does the result is stocked in the variable RESULTVAR. I don’t understand.
I see an icon near:

How do you do ? I check in all properties, i see nothing. What did i miss ?



Each action has script events that you can fill out. To get to the script editor, highlight the action and then on the View menu, Script Editor (it’s a tab at the bottom alongside the Log etc).


(screenshot is from FinalBuilder which is based on the same code as Automise).

Ho ! I didn’t know this function. Thank a lot.