How to use Regex from Config File

Hello Team,

How can we use Regex defined in config file as Variable in Code

Example
If Config Contains

Name_ExtractedRegex | System.Text.RegularExpressions.Regex.Match( filtereddata,@“(?<=Passport-Number\W)(\w.*)$”).Value

How can we use this variable
Name_ExtractedRegex in Code

Thanks in advance

@NISHITHA

config(“Name_ExtractedRegex”).ToString

Hi @NISHITHA

Use as below in assign activity

RegexVariavle = Config("Name_ExtractedRegex").ToString

Hope it helps!!

Regards.

@rlgandu and @vrdabberu thanks for the prompt Response

The Variable type would be String

For
RegexVariavle

Hi @NISHITHA

RegexVariavle = Config("Name_ExtractedRegex").ToString

The RegexVariable will be of DataType System.String only.

Regards

Hi @NISHITHA

Try this: Assign Acitivty
Str_YourVariable = Config(“Name_ExtractedRegex”).ToString

Happy Automation :slight_smile:

@NISHITHA

OutputRegex is a string Variable

OutputRegex=config(“Name_ExtractedRegex”).ToString

This will be stored as a string

Hope it helps

@Nawazish_Ahmad

filtereddata variable is the extracted Text

If Config Contains

Name_ExtractedRegex | System.Text.RegularExpressions.Regex.Match( filtereddata,@“(?<=Passport-Number\W)(\w.*)$”).Value

How do we incorporate that here in Code the filtereddata

RegexVariavle = Config(“Name_ExtractedRegex”).ToString

@NISHITHA

Use .Replace(“filtereddata”,YourVariable)

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