I want to read specific text from pdf . How should I read it

Still same error

@Bhushan_Nagaonkar ,

There was also a ( missing in your pattern at the Beginning :slight_smile:

1 Like

I will look for it. Sorry for late reply btw.

I have one last query. I need help in understanding if there are multiple document and sometime s the format is different how am I supposed to get output from it.

MicrosoftTeams-image (83)
MicrosoftTeams-image (78)

Above are two format. I wont be able to use get text. I will have to use read pdf and then pass read value from it. What is the regex method/condition for this?

@Manju_Reddy_Kanughula @vishal.kp @supermanPunch @ushu @Gokul_Jayakumar


I guess i have written correct this time but the error is persisting.

MicrosoftTeams-image (84)
MicrosoftTeams-image (85)

Hi @Bhushan_Nagaonkar ,

Try this, using a for each loop you can get all the social security number matched:




1 Like

What do those values represent and will the brackets will be included with that

@Bhushan_Nagaonkar , the social security number is 9 digits and in the format of xxx-xx-xxxx. Hence this pattern will be matching all the numbers appearing in that format. The brackets unclosing the pattern are just to get it to group 1, you can avoid the brackets in the pattern, the matches will be present in group 0.

If your question was about the square bracket, then just use .string at the end.


1 Like

Thankyou so much. I’ll try this method and let you know.

1 Like

@Bhushan_Nagaonkar ,

Checking the Expression again, you have the brackets added at the end of the pattern (after +), which is not needed, and so the error also states the same.

1 Like

I will check. I got the output as 12. But it is not right. The changes you asked are right but the output is not right

Hi, Im able to get the output properly, thankyou for your time.
But for Item[2] there is where im facing an issue

This is my output
I tried all the mentioned methods above sometime my output is 12 or


1 Like

@Bhushan_Nagaonkar, you will get the count of matches from the expression and from it, you can decide how many items should be indexed from the matched results/ use for each to print all the values.


In second format I’m not getting a proper output.
Its either 12 or system.

@Bhushan_Nagaonkar ,

Could you share the Expression again ? What was used ?

Also, In addition do note that a proper sample format example of your data was not provided, we are providing the expression or data based on assumptions and that is why we are not able to conclude faster, we could have reduced the convo or discussion if the sample data was provided leading to more productivity and closing the discussion faster.

Yes in a minute.

MicrosoftTeams-image (86)

@Bhushan_Nagaonkar ,

Again, we do not know the full context of what is it that you want to perform.

Do you have multiple Social Security number in a Single Input text that you want to extract or only one.

If Only one, Use Match instead of Matches.

The Pattern is also missing the hyphen -.

Earlier provided Expression :

The following format is like this. This is the only way I can showcase.

@Bhushan_Nagaonkar ,

Check with the below regex Expression :

(?<=a Employee's social security number.*\s*\n)[\d-]+

Expression :

Regex.Match(strText,"(?<=a Employee's social security number.*\s*\n)[\d-]+").Value.Trim

Visuals :

1 Like