Hi All,
I have a problem while replacing all Email Id's in a directory of .php files with some other email id using linux sed function and php system function.Here the code looks like this,
//
$data="find . -name "*.php" | xargs sed -i s/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/nagarajuv@gmail.com/g";
system($data);
//
when I use Email id in place of regular expression it is working fine.Can anyone help me in this
Thanks,
Nagarajuv
Replace all Emails in all php files using Linux sed with php
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Replace all Emails in all php files using Linux sed with php
It doesn't match any emails? The regex should match: me@example.com but not: me@mail.example.com. You might try single quotes around the $data string.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Replace all Emails in all php files using Linux sed with php
I tried with single quotes but its still giving a problem. Can you please give the regular expression that match all emails in all .php files using linux sed function along with php system function or How can we do this with PHP script.Please help me I am new to this environment.
Thanks for Reply
Thanks for Reply