Thank you Absolute ZERO. I would like to multiply your ID with the infinite :)
I have tried your answer but it does not work. So I have made a little tweak on it. Before going on, I should clarify my situation a bit more to help for readers on this post.
I have a variable $urls in PHP. This is a link url for sending user to target page.
In this variable, there are many patterns including those two:
news.oxo.com/site/data/html_dir/2013/05/25/2013052500007.html
salute.com/arti/society/health/588947.html
With your answer and my tweak, I have managed to send users to mobile page.
$urls = get_post_link(~~~~~);
//patterns for m.oxo
$replacements[0] = 'm.oxo.com/article.html?contid=$1';
$patterns[0] = "!news.oxo.com/site/data/html_dir/[0-9]{4}/[0-9]{2}/[0-9]{2}/([0-9]+)\.html$!";
//patterns for m.salute
$replacements[1] = 'm.salute.com/article.html?contid=$1';
$patterns[1] = '!salute\.com/[^/]+/[^/]+/[^/]+/([0-9]+)\.html$!';
$url = preg_replace($patterns,$replacements,$urls);
I have one more question in regard of this question. Perhaps it would be right to post it by opening another question but since new question is closely related to the old one, I put this on here.
New question is what replacement and patterns should be used to replace
from
kr.hello.feedsportal.com/c/34762/f/640634/s/2c6bcfa2/l/0L0Shani0Bco0Bkr0Carti0Cpolitics0Cpolitics0Igeneral0C589130A0Bhtml/story01.htm
to
www.hello.co.kr/arti/society/society_general/589159.html
Thanks you!