Regex to get value next to certain word

Hi All
I have string containing multiple line . I need to take the value that is next to first meta content=

Kindly help

Please post some sample text…

@tharani.natarajan

Try this

System.Text.RegularExpressions.Regex.Match(str,"(?<=meta content=).*").Value

cheers

sample.txt (295.3 KB)

PFA the input .I need to get the followers count .

@tharani.natarajan

Please use this

System.Text.RegularExpressions.Regex.Match(str,β€œ(?<=meta content=").*(?=Followers)”).Value.Trim

cheers

I get all the value after the meta content= . I just need the followers count.Kindly help

@tharani.natarajan

Please use like thsi I believe i missed a extra double quote

System.Text.RegularExpressions.Regex.Match(str,"(?<=meta content="").*(?=Followers)").Value.Trim

cheers

I am getting all the values after the **Meta content= **

@tharani.natarajan

did you include this part? (?=Followers)

Else try

System.Text.RegularExpressions.Regex.Match(str,"(?<=meta content="")\d+").Value.Trim

cheers

1 Like

This worked.Thanks a lot

1 Like

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