Need Help Correct Regular Expression Redirect Code

At the top of your .htaccess file, before your existing WordPress directives, you could do something like the following to redirect the old permalink:

RewriteRule ^\d{4}/\d\d/([\w-]+\.html)$ /$1 [R=301,L]

The RewriteRule pattern matches against the URL-path less the slash prefix.

\d{4}/ – matches the 4-digit year, followed by a slash.

\d\d/ – matches the 2-digit month number, followed by a slash.

([\w-]+\.html) – matches the postname and .html extension. The surrounding parentheses make this into a capturing group which is then referenced in the substitution string with the $1 backreference. [\w-] matches characters in the range a-z, A-Z, 0-9, _ (underscore) and - (hyphen). If your postname can contain any other characters then these will need to be added to this character class (although the hyphen must appear last).

Test with a 302 (temporary) redirect to avoid caching issues in case anything goes wrong. 301 (permanent) redirects are persistently cached by the browser by default.