Regex with Variables


I have a Text file, that could look like this:

1 2 100.000,00 EUR Grundschutd ohne Brief zu einhunderttausend Euro für die mit 15 % Zinsen jährlich. Mit 5 % Nebenleistung einmalig. Vollstreckbar nach Rang vor Abit. II Nr. 1 aufgrund teilweiser Ausnutzung des Rangvorbehalts. Gemäß Bewilligung vom
tragen am 30.06.2021.

But this is only a little part of the whole text file.

So now i wanna search for the 100.000,00 EUR, and if this is True

  • Take the Date after einge-tragen am:

Does anybody knows how this is possible?

And the Value of (100.000,00) has to be out of a Variable.

So i need a Dynamic Search for this Value

Try this


Hi @Beere_Plays ,

Since the data is not complete, we are not sure of what patterns are possible, maybe some other similar samples could help us concrete the regex that we are trying to prepare.

However, at first glance, we could follow some options like the regex below :

(?=100.000,00)(.*\n)*tragen am\s+(\d{2}\.\d{2}.\d{4})

Here, we can assign a String variable with the value of the amount and replace the string variable with the value.

Expression :

System.Text.RegularExpressions.Regex.Match(yourInputString,"(?="+yourAmountStr+")(.*\n)*tragen am\s+(\d{2}\.\d{2}.\d{4})",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups(2).Value.ToString

Try this to extract the date


Thank you Very Very much!!!

It works

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.