Regex hangs

Why is a simple regex so slow that it appears to make a hang:

dim theRegex as new RegEx
theRegex.options.ReplaceAllMatches = true
theRegex.Options.Greedy = False
theRegex.Options.DotMatchAll = True
theRegex.SearchPattern = "<(br|p).*>"
theRegex.ReplacementPattern = CarbonModule.EndOfLineMacintosh
theText = theRegex.Replace(theText)

The affected text is a huge email already converted to html. How can I speed this up?

I’m keeping the br and p tags because some Filemaker users prefer text over html. I’m using RemoveHTMLTagsMBS to get rid of the other tags which is really fast.

Xojo 2020r2.1, High Sierra and BS.

When using the MBS plugin I don’t get a hang. Most likely my html makes a too deep recursion for Xojo.

The MBS version is generally faster.

But I’m curious, what happens if you remove .*?

1 Like

Or perhaps replace the .* with:

1 Like