C# regex definition -


Still there are problems in implementing the regex syntax - and in some languages, using different dialects does not make things easy .

I want to delete all links containing CID (whatever), replace them with empty string. So I defined:

  personal reggaege regex = new Regex ("& lt; a href = \" cid: {[a-f0-9 -] *} \ "& gt; [^ & Lt;]) & lt; / a & gt; ");   

and went for a replacement:

  html = regex.Replace (html, "");   

But for some reason, my reggax does not work.

The result is still included:

  & lt; A href = "cid: c524ae03-7ac7-4823-9a28-af17a6acf12f" & gt; Test.txt & lt; / A & gt;   

I also tried the following:

  New Reggae ("& lt; a href = \" cid: [a-f0-9 -] * \ "& Gt; ([^ & lt;]) & lt; / a & gt;"); New Reggae ("& lt; a href = \" cid: {([a-f0- 9-] *)} \ "& gt; ([^ & lt;]) & lt; / a & gt;") ; New Reggae ("& lt; a href = \" cid: ([a-f0-9 -] *) \ "& gt; ([^ & lt;]) & lt; / a & gt;");   

But I can not understand what is wrong with my Reggae ...

Try this:

  & lt; A href = \ "cid: [a-f0-9 -] * \" & gt; [^ & Lt;] + & lt; \ / A & gt; | Here the problem with your regex was that, your regex was not checked for only one letter  

here demo:

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -