How to replace the characters @ and . to an email address with a symbol - using the preg_replace() function in php?
@
.
-
preg_replace()
Since your search patterns are just strings, using string replacement using str_replace better than the other answer says.
str_replace
Here's the answer of preg_replace :
preg_replace
$str = preg_replace('/@|\./','-',$str);
No need to use preg_replace .
Use str_replace :
$output = str_replace(array('@', '.'), '-', $input);
Source: https://habr.com/ru/post/1379470/More articles:Use Regex in Javascript to get file name in url - javascriptHow to create an AS / 400 team with mutually exclusive parameters? - commandHow to handle postback in usercontrol using click button on MasterPage - asp.netWhat is the advantage of using goto in this code? - cHow to play sound on all audio devices - c #Using Perl on Windows, how can I guarantee that I get the path in the right case after chdir? - windowsAndroid and Python - pythonMachine Accuracy Assessments - floating-pointHow to find ActiveSync attributes from Exchange using C #? - .netNew Ruby Line Separator - ruby ββ| fooobar.comAll Articles