CodeIgniter Forums
Issue with RegEx contains pipe (|) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Issue with RegEx contains pipe (|) (/thread-75276.html)



Issue with RegEx contains pipe (|) - webdevron - 01-21-2020

I am using some regex in my validation. Others are working well but this:

regex_match[/((?:https?:\/\/)?(?:www\.)?(?:\w\w\.)?example\.com\/)((([\w]{2,3})?)|([^\/]+\/(([\w|\d-&#?=])+\/?){1,}))$/]

Error is:
preg_match(): No ending delimiter '/' found
"/((?:https?:\\/\\/)?(?:www\\.)?(?:\\w\\w\\.)?linkedin\\.com\\/)((([\\w]{2,3})?)|([^\\/"


After searching about this issue just found that, there was an issue about it (1122) though it was solved.


RE: Issue with RegEx contains pipe (|) - InsiteFX - 01-21-2020

Try adding the the ending slash to it like so.

PHP Code:
|/ 

See if that will work.


RE: Issue with RegEx contains pipe (|) - webdevron - 01-21-2020

(01-21-2020, 09:18 AM)InsiteFX Wrote: Try adding the the ending slash to it like so.

PHP Code:
|/ 

See if that will work.

Adding
PHP Code:
|/ 

showing the following result:

Code:
preg_match(): Unknown modifier '('