java - Regex exclusion behavior -


OK, so I know that this question has been asked many times in different forms, but I have a specific syntax Having trouble with I have a big string in which there are html snippets. I have to search each link tag which is not already a target = attribute (so that I can add one as needed).

^ ((?! Target!) * Text that leads me to 'Goal', and & lt; A. +? & Gt; [\ W \ w] +? & Lt; / A & gt; will give me a link, but the place where I am stuck is an example:

   

Any suggestions? Using DOM or XPAT is not really an option because this snippet does not constitute HTML.

If you insist on doing this with a regx like this should help. .

  & lt; A (?! [^ & Gt;] * target =) [^ & gt;] * & gt; *? & Lt; / A & gt;  

This does not mean that 100% may be right technically speaking in one tag,> from one end to another, so it will not work for all HTML tags.

NB I work with PHP, you may have to make some syntax adjustments for Java.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -