CORS plugin: how does it know if it's a string or a regex?

The documentation for the CORS plugin’s config.origins parameter says:

The accepted values can either be flat strings or PCRE regexes.

How does Kong know if the value is a flat string or a regex?

Thanks!

For other people who have the same question, I found this topic explaining how this works.