I am having a problem with some Regex and i don't know how to fix. Take a look at the following code:
if (Regex.IsMatch(input, "<[aA].*xlink:href.*>.*</[Aa]>"))
Now, there is other code with this conditional statement but it's not relevant as to what i am having problems with. This code checks for an a href link. I have 2 instances of links:
<a title="Meet the Team" xlink:href="tcm:12-1451" xlink:title="Meet the Team">Meet the Team</a>
<a title="Meet the Team" href="tcm:8-1451">Meet the Team</a>
The top one works fine, but the bottom one does not because it doesn't have the "xlink" appended at the start. Does anyone know how i can change the regex so that it matches both?
Not a guru of RE, someone lese can help you there, but why are you using XLink?
I don't know if .NET uses Perl flavor regex, but if so try putting the "sometimes threre sometimes not" inside parentheses followed by a question mark (i.e. 0 or 1 occurences)