문자열에서 주석구문을 제거하는 PHP 정규식
페이지 정보
본문
/* */주석
[code]
<?php
$str = preg_replace('/\/\*(.*?)\*\//is', '', $str);
?>
[/code]
<!-- -->주석
[code]
<?php
$str = preg_replace('/<!--(.*?)-->/is', '', $str);
?>
[/code]
//주석
[code]
<?php
$str = preg_replace('/\/\/(.*)\n', '', $str);
?>
[/code]
#주석
[code]
<?php
$str = preg_replace('/#(.*)\n/', '', $str);
?>
[/code]
'주석
[code]
<?php
$str = preg_replace('/'(.*)\n/', '', $str);
?>
[/code]
* 출처 : http://openlife.tistory.com/378
[code]
<?php
$str = preg_replace('/\/\*(.*?)\*\//is', '', $str);
?>
[/code]
<!-- -->주석
[code]
<?php
$str = preg_replace('/<!--(.*?)-->/is', '', $str);
?>
[/code]
//주석
[code]
<?php
$str = preg_replace('/\/\/(.*)\n', '', $str);
?>
[/code]
#주석
[code]
<?php
$str = preg_replace('/#(.*)\n/', '', $str);
?>
[/code]
'주석
[code]
<?php
$str = preg_replace('/'(.*)\n/', '', $str);
?>
[/code]
* 출처 : http://openlife.tistory.com/378
추천0
댓글목록
등록된 댓글이 없습니다.