Monday, December 14, 2009

Setup subversion modules for apache2 on OpenSUSE 11.1

I had installed apache2 earlier using the zypper command and it was running ok. To install subversion, I ran:
# zypper install subversion-server

That install went smoothly. From my previous experience setting up apache2 for clustering tomcat, I knew that enabling and disabling modules was to be accomplished through the a2enmod and a2dismod commands respectively. This is an excellent alternative to hand editing the configuration files.

After some trial and error, the commands listed below are what was needed to get the modules setup correctly. The order of commands is important as the modules need to be loaded in the order of dependency.

# a2enmod dav
# a2enmod dav_svn
# a2enmod authz_svn


Additionally, the following links helped me complete the process of setting up the server:
Apache Howto SSL - opensuse.org
Setting up a Subversion server using Apache2 - opensuse.org
Configuring Apache for Subversion use- techrepublic.com

Tuesday, December 1, 2009

Regex Repetition Matching

I use regex on and off. A situation arose where I needed to use repetition matching, something I knew existed but had never used before.

I needed to match a string with at most 36 characters. Using the regex below worked but it also matched strings with commas inside them
.{,36}
I specified that I did not wish to have commas in the string, resulting in this next expression.
[^,].{,36}
After this change, the expression stopped matching the target strings e.g. 9F7096D0D20949ACB2DA1EE57488F015
or
99AD7ECC-222A-AC8A-4BF8-F04B159DDBFB
It instead matched a string like
9200','LI','NA',null,'Y','L','N','N',

Realizing that the attempt to leave out the commas had caused the trouble, I adjusted the expression, which matched the desired strings.
[^,]{,36}