In reply to Eleonore Ubin.

I should probably clarify that "have never" is really "almost have never". Basically, they've been disallowed for almost the entirety of the Themes Team's existence. There was a time before the team became formalized. There were also a few exceptions. Namely, shortcodes for use in templates (but not for content) were allowed for a while. Eventually, the team just banned them altogether because it was an increasingly uncommon use case. But, the team did take a hard stance against shortcode for use in content.

There are a few "special cases" where CPTs were given an exception, especially in the early years. And, they did allow for other special cases, such as storing options as CPTs at one point. I'm absolutely certain a few disallowed cases slipped through the cracks.

I didn't feel it necessary to dive deep into the full decade-plus history and each exception since it's not really relevant to what you brought up. I could, considering I was a team member for most of those years and a team rep/lead for a good portion of that.

But, the point still stands. This is not some type of new rule. It has been the standard since the early days of the Themes Team once it formalized the initial guidelines.

Nevertheless, your regex for those searches is not an exact match for using register_shortcode() and register_post_type(). There are far too many false-positives.