Changes

From SME Server
Jump to navigationJump to search
1,293 bytes added ,  16:46, 27 November 2014
Line 15: Line 15:     
smeserver-dar2 pour le panel  
 
smeserver-dar2 pour le panel  
 +
====Using Simple "Wildcards" and "Repetitions"====
 +
Calling these "wildcards" may actually conflict with the theoretical grammar and syntax of Perl, but in fact is the most intuitive way to think of it, and will not lead to any coding mistakes.
 +
 +
.  Match any character
 +
\w  Match "word" character (alphanumeric plus "_")
 +
\W  Match non-word character
 +
\s  Match whitespace character
 +
\S  Match non-whitespace character
 +
\d  Match digit character
 +
\D  Match non-digit character
 +
\t  Match tab
 +
\n  Match newline
 +
\r  Match return
 +
\f  Match formfeed
 +
\a  Match alarm (bell, beep, etc)
 +
\e  Match escape
 +
\021  Match octal char ( in this case 21 octal)
 +
\xf0  Match hex char ( in this case f0 hexidecimal)
 +
 +
You can follow any character, wildcard, or series of characters and/or wildcard with a repetiton. Here's where you start getting some power:
 +
 +
*      Match 0 or more times
 +
+      Match 1 or more times
 +
?      Match 1 or 0 times
 +
{n}    Match exactly n times
 +
{n,}  Match at least n times
 +
{n,m}  Match at least n but not more than m times
 +
 +
Now for some examples:
 +
 +
$string =~ m/\s*rem/i;  #true if the first printable text is rem or REM
 +
 +
$string =~ m/^\S{1,8}\.\S{0,3}/;  # check for DOS 8.3 filename
 +
                                  #  (note a few illegals can sneak thru)
 +
 +
 +
 +
 
====search about db in template====
 
====search about db in template====
 
  grep -srni '${[A-Za-z0-9]\|$[A-Za-z0-9]\|_prop' /etc/e-smith/templates*| grep '}\|_prop' |less
 
  grep -srni '${[A-Za-z0-9]\|$[A-Za-z0-9]\|_prop' /etc/e-smith/templates*| grep '}\|_prop' |less
 
or
 
or
 
  grep -srni '${[A-Za-z0-9]\|$[A-Za-z0-9]\|_prop' /etc/e-smith/templates*| grep '} |\|}|\|_prop' |less
 
  grep -srni '${[A-Za-z0-9]\|$[A-Za-z0-9]\|_prop' /etc/e-smith/templates*| grep '} |\|}|\|_prop' |less
 +
 
====70-persistent-net.rules====
 
====70-persistent-net.rules====
 
  [root@sme9 ~]# locate 70-persistent
 
  [root@sme9 ~]# locate 70-persistent

Navigation menu