Configure space while Extracting Data

Hii Team,

We are currently extracting data using this approach

System.Text.RegularExpressions.Regex.Match(textfound,“(?<=Project Value[-:=]\s*)\w.*”).Value

But the Project Value can be present with space or without space(After Project Value) so how can we configure that have tried using Trim

Example:
1)Project Value - ABC
2)Project Value- XXX
3)Project Value -YYY

Thanks team in advance

Hi @anmita

Please try using the following RegEx pattern:

Project\s*Value\s*[-:=]?\s*(\w+)

image

Hope this helps,
Best Regards.

Hi @anmita ,

Could also try in the below way :

(?<=Project Value\s*\-\s*).*

A Trim operation would be required after the Extraction

@arjunshenoy , @supermanPunch thanks for the quick responses

Just a question can it work in all scenarios if they have not kept any space

Example:

Project Value-XNN

@anmita ,

You could check the same in here : https://regex101.com/

So, When failing you can get the Input data on which it is failing and provide us with more info on the pattern.

Currently, it does accept with spaces or no spaces, but also a Hyphen is needed to be present.

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