A regular expression is a syntax rule that describes the result of a string and is a specific formatting pattern that matches, replaces, and intercepts matching strings. Commonly used languages have regular expressions, such as JavaScript, Java, and so on. In fact, only by understanding the regular use of one language, the other language of the regular use, it is relatively simple. This article focuses on the use of regular code to remove the annotation method in PHP
Test code
File: A. Php
<?php/** * Addition calculation * Test *///set $ A value of $ A = 10;//set $b value $b = 5;//Add $c = $a + $b; # output echo $c;
Files: test.php
echo "Source: <br/>"; Show_source ('./a.php '); echo "
Test output
Execute test.php, output as follows:
Regular analysis
(\/\*.*\*\/) Match/* */(#.*?\n) Match # after the first carriage return ended (\/\/.*?\n) match// end after the first carriage return is encountered