I have a text file with some configuration value. There a comment starts with a #
I am trying to find a regular expression pattern that will find out all the lines that start with a #
So, sample file:
1st line
#test line this
line #new line
aaaa #aaaa
bbbbbbbbbbb#
cccccccccccc
#ddddddddd
I want to find
#test line this
#ddddddddd
because only these two lines start with #
I tried the following code:
preg_match_all("/^#(.*)$/siU",$text,$m);
var_dump($m);
But it always outputs empty array. Anyone can help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…