-1
private static string BuscaComparacao (string url)
{
Regex r =new Regex("\S+\D{3}[.]\D{3}\S+\D)";
var result = r.Matches(url);
return result[0].ToString();
}
the code does not find the data I sent for.
What information is being researched? You need to further clarify your question.
– João Martins
a regular expression ta right, but it says that Message = "analyzing " s+ d{3}[. ] d{3} s+ d)" - Excessive number of )’s."
– mateus andrade
It does not lack a parenthesis at the beginning of the expression? new Regex("( S+ D{3}[. ] D{3} S+ D)"? Or the parenthesis at the end is too much?
– João Martins
yes, corrected, but not returning anything, is that you are giving error by sending the url of a pdf
– mateus andrade
What you want to get with regular expression?
– João Martins
042.964 3 (concrete unit and verification code)
– mateus andrade
Let me get this straight, you’re passing a URL to the method. Right?
– Jéf Bueno
This is C: Annex 26342018013427.pdf
– mateus andrade
now exiting giving the Message = "Specified argument was outside the range of valid values. r Parameter name: i" would be why it needs iis to read the pdf?
– mateus andrade
Being a path to a file, what do you want with regular expression? Get file name? From folder?
– João Martins
obtain data within the file
– mateus andrade
@This is impossible. What you are doing is applying the regex to the text
C:\\AnexosEmail\\26342018013427.pdf
– Jéf Bueno
would have to convert the pdf to text first?
– mateus andrade
You will need to use an external library, such as Docotip.pdf or Itextsharp. The way you are doing is just applying regular expression to the URL itself and not inside the file.
– João Martins
Use this library, it is easy to use and then you can search the text for what you need. https://www.codeproject.com/Articles/14170/Extract-Text-from-PDF-in-C-100-NET
– João Martins