How to extract the word from text lines using regex

I want to extract the B10 or B10(a) from below text. How can i do this ?
I have tried with regex i am getting null value.

“Annual Maintenance Contracts - IT Operating expenditure (namely AMCs and repairs) - IT Operating Expenditure (namely server / storage / appliances / hardware / software / technology infrastructure related AMCs and repairs) B10.”

@shailesh1920

System.text.RegularExpresion.regex.match(input,“[A-Za-z0-9]+$”).value

image

1 Like

Hi @shailesh1920

Use this regex:

[A-Z]+[0-9]+(?:\([a-zA-Z]\))?

This regex will work for both the type you required.

Hope it helps!!

I tried your solution with below syntax but i am getting empty value

System.Text.RegularExpressions.Regex.Match(DFPText, “[A-Z]+[\d]+|(?:([A-Za-z]))?”).Value

@shailesh1920

(?<=)\s)[A-Z \d]+

It’s working fine at my end Please do check once.

Regards,

@shailesh1920

can you check this once

try once if you face any issues let me know

what is the data type of match variable ?

Hi @shailesh1920

[A-Z]+[0-9]+(?:\([a-zA-Z]\))?

The variable type is String. Use the above Regex expression.

Regards

Getting below error…

Assign: Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

@shailesh1920

Make sure you give the double quotes correctly and run the process. Delete the Double Quotes and give it again.

Regards,

@shailesh1920

Str_Value=System.Text.RegularExpressions.Regex.Match(Input,“(?<=)\s)[A-Z \d]+”).Value

@Parvathy Thanks for the solution.

Could you please help me to learn the creation of REGEX patterns ??

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