Still same error
There was also a
( missing in your pattern at the Beginning
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.
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?
I guess i have written correct this time but the error is persisting.
Hi @Bhushan_Nagaonkar ,
Try this, using a for each loop you can get all the social security number matched:
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.
Thankyou so much. I’ll try this method and let you know.
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.
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 there is where im facing an issue
This is my output
I tried all the mentioned methods above sometime my output is 12 or
@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.
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.
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
The Pattern is also missing the hyphen
Earlier provided Expression :
Check with the below regex Expression :
(?<=a Employee's social security number.*\s*\n)[\d-]+
Regex.Match(strText,"(?<=a Employee's social security number.*\s*\n)[\d-]+").Value.Trim