Regex in html question

My regex mojo is not with me today. Why doesn’t the following regex

border *(=|:) *("0"|none);?

match this text:

[quote] margin: 0;
padding: 0;
background:
none; border:
none;
white-space:
normal;
line-height:
normal;
overflow:[/quote]

The code is:

dim theRegex as new RegEx theRegex.options.ReplaceAllMatches = true theRegex.Options.Greedy = False theRegex.Options.DotMatchAll = True theRegex.Options.TreatTargetAsOneLine = True theRegex.SearchPattern = "border *(=|:) *(""0""|none);?" theRegex.ReplacementPattern = "" Return theRegex.Replace(theHtml)

I need to remove the 2 forms of border=“0” or border:none from html. RegeExRX finds the form border=“0” but not the border:none one. As usual the html isn’t really sane.

Any ideas what I’m doing wrong? Xojo 2018r3.

Try \s instead of the space so it’ll match new lines as well.

Try this:

\\bborder\\b\\s*[:=]\\s*("0"|none)(?:\\s*;)?

Note that this pattern only has one subgroup, not two as in your original pattern.

Thanks, guys, both solutions work fine. The subgroups don’t matter because I need to nuke the empty border.