PHP preg_match regular expression

  • ^ Indicates the start line locator $ represents the end

the preg_match (pattern string to be searched, $ matches) which is optional matches, once a match, the matching result may be returned

for example:

$ Pattern = '/ # \ S + /'; \ S represents any non-whitespace characters (used in the examples because it is not be used here is the Chinese \ w)

$ Mystr = "(r '/ loadcolspage', loadcolspage), # column processors";

preg_match($pattern,$mystr,$matches);

var_dump ($ matches);

Print Results: 
Array ( . 1 ) { 
  [ 0 ] =>
   String ( 13 is ) " # column processors " 
}

 

Guess you like

Origin www.cnblogs.com/saintdingspage/p/10929880.html