levkaster levkaster - 5 months ago 15
C# Question

Find all <a> tags in which first attributes isn't 'title'

I'm trying to fix my site to meet WCAG 2.0. This means that all links in my site must have a title. To do it right and not miss any

tags, I'm ading title to each link as a first attribute :

<a title="..."

But this site has a lot of links and I'm struggling to find all the links without a title. Can anyone help me with a regular expression that I could use to find all tags that start with
but the next letter isn't 't'?

If someone has an answer on how to find specific tag without specific attribute it will be even better! I'm working on visual studio 2015

Jan Jan

Generally, it is not a good idea to use regular expressions on a complex system like a DOM. However, in your (simple) example, you might get along with:


This ignores links with a title attribute, regardless where they are. See a demo on regex101.com.

Remember that it will fail on e.g. <a href="http://python.org" data="Here comes a title">This one fails</a> not matching it in the way you intented.