Highlight phrase carriage return

hi we have problem with phrase go on carriage return we have tested different regular expression but with no result :
blue\spanorama\b
blue\npanorama\b

i’ll attacch to you the pdf .
the word is blue panorama

best regards 83—W-2031.pdf (465.8 KB)

@francescoesposito

Thanks for contacting support.

We were able to replicate the issue in our environment and for the sake of correction, we have logged it as PDFNET-44479 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

hi

no news for me ?

@francescoesposito

Thanks for your inquiry.

As the issue has recently been logged in our issue tracking system, it is pending for review. As soon as we have some certain news on resolution progress of the issue we will let you know. Please spare us little time.

We are sorry for the inconvenience.

@francescoesposito

Thanks for your patience.

We have investigated the earlier logged issue and as per our findings, every ordinary character (not metacharacter) in a regular expression has their literal character meaning. Therefore pattern ‘blue\spanorama’ means ‘blue panorama’ but not ‘BLUE PANORAMA’ and not ‘Blue Panorama’. Please use ‘(?i)’ to turn on case-insensitive matching.

Please also take into account, we use ‘\r\n’ as newline in the extracted text (but it may depends on platform.). Therefore we recommend ‘(?i)blue\r\npanorama\b’ expression to find words separated by newline marker. Or ‘(?i)blue\s+panorama\b’ expression to find both plain and multi-line positioning of ‘blue panorama’ text.

Please consider the following code:

Document pdfDocument = new Document(myDir + "83---W-2031.pdf");
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(@"(?i)blue\s+panorama\b");
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;
pdfDocument.Pages.Accept(textFragmentAbsorber);
foreach (TextFragment tf in textFragmentAbsorber.TextFragments)
{
    Console.WriteLine(tf.Text);
}

Please use suggested approach with Aspose.PDF for .NET 18.5 and in case you still face any issue, please feel free to let us know.