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

본문 바로가기
사이트 내 전체검색

개발

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

페이지 정보

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

본문

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

댓글목록

등록된 댓글이 없습니다.

Total 386건 6 페이지
  • RSS

검색


사이트 정보

Copyright © Baragi.Net. All rights reserved.