background preloader

PERL

Facebook Twitter

Regexps. Xxaxx's Xperimints #2Regular Expressions "Regular expressions" look like Greek or some other totally incomprehensible language. I'm told they are actually reasonably simple, once you get the hang of them. Well, I can tell you that in the beginning they look like a cross between gibberish and magical incantations. Hopefully this tutorial will spread some light on the subject. Regular Expressions are used for "matching". This is all part of the process of finding stuff that contains something or is equal to something.

Any character that isn't a special character mentioned below matches itself. For example: Newbie -- matches the string "Newbie". One of the first special characters is the dot '.' .ewbie -- will match the string "Newbie", and "Rewbie" and "Sewbie", etc. The next special characters is the star '*' Any character followed by a star '*' matches that character repeated 0 or more times.

N*ewbie -- matches "Newbie", "NNewbie", or "NNNNNewbie", or "ewbie". The question mark "? " N? O? Xxaxx's Xperimint #3 -- .htaccess. Xxaxx's Xperimints #3.htaccess This funny named file ".htaccess" can do many things. One thing it can do is define whether or not SSI includes are turned on. The following code turns on SSI and tells the server that the file extention to operate SSI on is ".shtml": Options Includes AddType text/x-server-parsed-html .shtml Oops, we forgot to define SSI. "SSI" is Server Side Includes. Another thing that the ".htaccess" file is good for is password protecting a directory. If we put the following file .htaccess into a directory.

AuthUserFile /home/n/ne/newbie/public_html/gazette/xxaxx/testvault/.htpasswd AuthGroupFile /dev/null AuthName Xxaxxperiment Text Vault AuthType Basic require valid-user For example we could put it into the directory /home/n/ne/newbie/public_html/gazette/xxaxx/testvault/. In addition to the directory in which the ".htaccess" file is stored being protected any directory below that directory is protected as well. Etc. pwd [enter] File Organization--Regular Expressions. CGI Programming 101 - Learn CGI Today! Perldoc.com - Perl Documentation. Perl-packed beginner essays. Perl.com: The Source for Perl -- perl develop...