url 정규식 치환좀 도와주세요
본문
게시판에서 wr_content를 변형하고있는데요.
a태그에서 url부분만 치환하려는데 정규식좀 알수있을까요??
www.naver.com/index.html , m.naver.com/index.html , naver.com/aaa/index.html
위와같은 주소를
아래와같이 바꾸고싶어요....
aaa.com/index.html , aaa.com/index.html , aaa.com/aaa/index.html
정규식은 젬뱅이라... ㅜ,.ㅠ
답변 1
$str = 'sdfdf<a href="https://www.naver.com/index.html">www.naver.com</a>
, <a href="http://m.naver.com/index.html">index</a> ,
sdfsff<a href="http://naver.com/aaa/index.html">naver.com</a>xlk;vxvk';
preg_match_all("#<a\s+href=[\"\']([^\"\']+)[\"\']#", $str, $m);
print_r($m[1]);
답변을 작성하시기 전에 로그인 해주세요.