문자열에서 주석구문을 제거하는 PHP 정규식 > 개발

본문 바로가기

사이트 내 전체검색

뒤로가기 개발

문자열에서 주석구문을 제거하는 PHP 정규식

페이지 정보

작성자 관리자 (61.♡.26.29) 작성일 17-06-13 23:16 조회 3,739 댓글 0

본문

/* */주석
[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

댓글목록 0

등록된 댓글이 없습니다.

전체 386건 6 페이지
게시물 검색
Copyright © Baragi.Net All rights reserved.
PC 버전으로 보기