Mac: replace text inside files in directory using regular expression

I need to replace all matches (regular expression) in directory from “*::” to be “*::”
examples: (in multiple php files)

ID::
user::
process::

....

to be:

ID::
user::
process::

I currently use,single commands

find . -type f -name '*.php' -exec sed -i '' s/ID::/\ID::/ {} +
find . -type f -name '*.php' -exec sed -i '' s/user::/\user::/ {} +
find . -type f -name '*.php' -exec sed -i '' s/process::/\process::/ {} +

how to write regular expression to replace any “*::” => “*::”

thanks,


Source: regex

Leave a Reply