A
A
Alex Ivanov2016-08-29 22:40:16
Domain name market
Alex Ivanov, 2016-08-29 22:40:16

How to hide a domain?

I have a task to hide the full domain name by mask.
for example

https://toster.ru -> https://t***r.ru
http://google.com -> http://g***e.com

those. leave only the first and last letters of the name and leave the zone completely. Tried preg_replace, but something doesn't work. Can you help with the rule?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2016-08-29
@Protossan

preg_replace('/^(https?:\/\/.).*(.\..*)$/','\1***\2', 'http://google.com');

So?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question