Advertisement
reenadak

php regular expressions

Sep 25th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.78 KB | None | 0 0
  1. foreach(glob("*.php") as $file)
  2. {
  3.     if( in_array( $file, array("page-view.php","page-edit.php","index_old.php","index.php") ) ) continue;
  4.     echo "<a href='".$file."'>".pathinfo($file, PATHINFO_FILENAME)."</a><br>&nbsp;<br>";
  5. }
  6.  
  7. PHP Regular Expressions
  8.  
  9. [0-9]   It matches any decimal digit from 0 through 9. 
  10. [a-z]   It matches any character from lower-case a through lowercase z.
  11. [A-Z]   It matches any character from uppercase A through uppercase Z.
  12. [a-Z]   It matches any character from lowercase a through uppercase Z.
  13.  
  14. p+  It matches any string containing at least one p.   
  15. p*  It matches any string containing zero or more p's. 
  16. p?  It matches any string containing zero or more p's. This is just an alternative way to use p*.  
  17. p{N}    It matches any string containing a sequence of N p's   
  18. p{2,3}  It matches any string containing a sequence of two or three p's.
  19. p{2, }  It matches any string containing a sequence of at least two p's.   
  20. p$  It matches any string with p at the end of it. 
  21. ^p  It matches any string with p at the beginning of it.
  22.    
  23. [^a-zA-Z]   It matches any string not containing any of the characters ranging from a through z and A through Z.   
  24. p.p     It matches any string containing p, followed by any character, in turn followed by another p.  
  25. ^.{2}$      It matches any string containing exactly two characters.   
  26. <b>(.*)</b> It matches any string enclosed within <b> and </b>.
  27. p(hp)*      It matches any string containing a p followed by zero or more instances of the sequence php.
  28.  
  29.    
  30. [[:alpha:]] It matches any string containing alphabetic characters aA through zZ.
  31. [[:digit:]] It matches any string containing numerical digits 0 through 9.
  32. [[:alnum:]] It matches any string containing alphanumeric characters aA through zZ and 0 through 9.
  33. [[:space:]] It matches any string containing a space.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement