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

**URL:** <https://discuss.konghq.com/t/cors-plugin-how-does-it-know-if-its-a-string-or-a-regex/6903>\
**Category:** Questions\
**Created:** [August 12, 2020, 6:18pm UTC](https://discuss.konghq.com/t/cors-plugin-how-does-it-know-if-its-a-string-or-a-regex/6903 "2020-08-12T18:18:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dserodio](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/dserodio/32/2022_2.png) [@dserodio](https://discuss.konghq.com/u/dserodio)\
**Post date:** [August 12, 2020, 6:18pm UTC](https://discuss.konghq.com/t/cors-plugin-how-does-it-know-if-its-a-string-or-a-regex/6903/1 "2020-08-12T18:18:24Z")

</div>

The [documentation](https://docs.konghq.com/hub/kong-inc/cors/#parameters) 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!

---

<div class="post-metadata">

**Author:** ![dserodio](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.konghq.com/dserodio/32/2022_2.png) [@dserodio](https://discuss.konghq.com/u/dserodio)\
**Post date:** [August 17, 2020, 4:54pm UTC](https://discuss.konghq.com/t/cors-plugin-how-does-it-know-if-its-a-string-or-a-regex/6903/2 "2020-08-17T16:54:17Z")

</div>

For other people who have the same question, I found [this topic](https://discuss.konghq.com/t/a-few-words-on-regex-uris-usage-and-common-pitfalls/506) explaining how this works.
