I have some lengthy regex and I keep getting an error in ui5 webide and javascript using the replace function. I tried it in php using preg_replace and nothing happened. I am trying to remove the phone numbers and emails from the string "Feedback. (709)875-2711, 1(709)875-2711, uddalok.biswas@gmail.com hello.". Do I need to escape something? In php I am
Here is my regex for javascript and u5
/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/g
/^\S+@\S+$/g
/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/g
/(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/g
Here is my regex for php
'/^([0-9]( |-)?)?(\(?[0-9]{3}\)?|[0-9]{3})( |-)?([0-9]{3}( |-)?[0-9]{4}|[a-zA-Z0-9]{7})$/'
'/^\S+@\S+$/'
'/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/'
'/(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/'
The regex isn't doing anything in php and in ui5 controller I am using replace and getting an error unexpected token.
The expected result is the regex will match with phone numbers and emails in a large string either in php or javascript.