reenadak icon

php regular expressions

reenadak | PRO | 09/25/17 06:43:10 PM UTC | 0 ⭐ | 344 👁️ | Never ⏰ | []
PHP |

1.78 KB

|

None

|

0 👍

/

0 👎

foreach(glob("*.php") as $file)
{
    if( in_array( $file, array("page-view.php","page-edit.php","index_old.php","index.php") ) ) continue;
    echo "<a href='".$file."'>".pathinfo($file, PATHINFO_FILENAME)."</a><br>&nbsp;<br>";
}
 
PHP Regular Expressions
 
[0-9]   It matches any decimal digit from 0 through 9.  
[a-z]   It matches any character from lower-case a through lowercase z.
[A-Z]   It matches any character from uppercase A through uppercase Z.
[a-Z]   It matches any character from lowercase a through uppercase Z.
 
p+  It matches any string containing at least one p.    
p*  It matches any string containing zero or more p's.  
p?  It matches any string containing zero or more p's. This is just an alternative way to use p*.   
p{N}    It matches any string containing a sequence of N p's    
p{2,3}  It matches any string containing a sequence of two or three p's.
p{2, }  It matches any string containing a sequence of at least two p's.    
p$  It matches any string with p at the end of it.  
^p  It matches any string with p at the beginning of it.
    
[^a-zA-Z]   It matches any string not containing any of the characters ranging from a through z and A through Z.    
p.p     It matches any string containing p, followed by any character, in turn followed by another p.   
^.{2}$      It matches any string containing exactly two characters.    
<b>(.*)</b> It matches any string enclosed within <b> and </b>.
p(hp)*      It matches any string containing a p followed by zero or more instances of the sequence php.
 
    
[[:alpha:]] It matches any string containing alphabetic characters aA through zZ.
[[:digit:]] It matches any string containing numerical digits 0 through 9.
[[:alnum:]] It matches any string containing alphanumeric characters aA through zZ and 0 through 9.
[[:space:]] It matches any string containing a space.

Comments