I’ve found the below mentioned information from different websites using Google. It is convenient to have all necessary information at one place, and that’s what I’ve done. I don’t take credit for anything written below.
Matching Pattern
Code Meaning
---- ----------------------------
\w Alphanumeric Characters
\W Non-Alphanumeric Characters
\s White Space
\S Non-White Space
\d Digits
\D Non-Digits
\b Word Boundary
\B Non-Word Boundary
\A or ^ At the Beginning of a String
\Z or $ At the End of a String
. Match Any Single Character
* Zero or More Occurrences
? Zero or One Occurrence
+ One or More Occurrences
{ n } Exactly N Occurrences
{ n,m } Between N and M Occurrences
.* <pattern> Less restrictive search, matches up to the last pattern
.*? <pattern> Restrictive search, matches up the first pattern
[ set_of_pattern ] Match Any pattern from within the set
[ ^ set_of_pattern ] Negates the match - does Not match any pattern Anything from the Set
Conditional Expressions
-A OPERAND Returns the access age of OPERAND when the program started.
-b OPERAND Tests if OPERAND is a block device.
-B OPERAND Tests if OPERAND is a binary file. If OPERAND is a file handle, then the current buffer is examined, instead of the file itself.
-c OPERAND Tests if OPERAND is a character device.
-C OPERAND Returns the inode change age of OPERAND when the program started.
-d OPERAND Tests if OPERAND is a directory.
-e OPERAND Tests if OPERAND exists.
-f OPERAND Tests if OPERAND is a regular file as opposed to a directory, symbolic link or other type of file.
-g OPERAND Tests if OPERAND has the setgid bit set.
-k OPERAND Tests if OPERAND has the sticky bit set.
-l OPERAND Tests if OPERAND is a symbolic link. Under DOS, this operator always will return false.
-M OPERAND Returns the age of OPERAND in days when the program started.
-o OPERAND Tests if OPERAND is owned by the effective uid. Under DOS, it always returns true.
-O OPERAND Tests if OPERAND is owned by the read uid/gid. Under DOS, it always returns true.
-p OPERAND Tests if OPERAND is a named pipe.
-r OPERAND Tests if OPERAND can be read from.
-R OPERAND Tests if OPERAND can be read from by the real uid/gid. Under DOS, it is identical to -r.
-s OPERAND Returns the size of OPERAND in bytes. Therefore, it returns true if OPERAND is non-zero.
-S OPERAND Tests if OPERAND is a socket.
-t OPERAND Tests if OPERAND is opened to a tty.
-T OPERAND Tests if OPERAND is a text file. If OPERAND is a file handle, then the current buffer is examined, instead of the file itself.
-u OPERAND Tests if OPERAND has the setuid bit set.
-w OPERAND Tests if OPERAND can be written to.
-W OPERAND Tests if OPERAND can be written to by the real uid/gid. Under DOS, it is identical to -w.
-x OPERAND Tests if OPERAND can be executed.
-X OPERAND Tests if OPERAND can be executed by the real uid/gid. Under DOS, it is identical to -x.
-z OPERAND Tests if OPERAND size is zero.
String Operator V/S Numerical Operator with example
eq == ($a == $b $a and $b are equal)
ne != ($a != $b $a is not equal to $b)
gt > ($a > $b $a is greater than $b)
lt < ($a < $b $a is lesser than $b)
ge >= ($a >= $b $a is greater or equal to $b)
le <= ($a <= $b $a is lesser or equal to $b)
No comments yet.