Posted 21 March 2022, 5:00 am ESTI am using the GcPdfDocument.FindText method with a regular expression search parameter. This method correctly finds matching text, but the result doesn't seem to include a property that shows the text that was actually matched. It has a NearText property, but it includes additional text "near" the found text (hence the name NearText, I guess). Is the exact matched text intentionally not returned for some reason? I guess I could use the .NET regex function on the NearText property to extract the exact text, but that feels like an unneccessary step. Am I missing something? Thanks.
Finding the matched text in a regex search
Posted by: jerrad.elmore on 21 March 2022, 5:00 am EST
Replied 22 March 2022, 2:01 am ESTAfter looking around a little more, I see the TextMapFragment property that appears to show the positions of the matched text within the NearText property, but it doesn't always seem to be the correct positions. I have attached a small project that hopefully demonstrates the issue.
Replied 22 March 2022, 8:49 pm ESTHello,
Thank you for the attached sample.
We are discussing this issue with the developers and will let you know the updates soon.
[Internal Tracking ID: DOC-4133]
Replied 3 April 2022, 10:45 pm ESTHello,
The requirement is not clear to the developers with your given comments. They have modified the sample, and PositionInNearText has correct value, please go through it and let me know if it works.
Marked as Answer
Replied 6 April 2022, 3:57 am ESTOk, so to extract the found text, I would need to do
It seems confusing to me that FoundPosition has a property for the start position, but not the length (I have to go into the TextMapFragment to get the length). Anyway, thanks for the help.