Well I can't say this will work at all, this is just a pointer on how you can do it. This is mostly because I'm at work and I don't have any ArchLinux install close at hand. I don't have any unix/linux machine close for that matter.
# Set the pattern you want to search for. Usage: ./script.sh alsa
# Create the list of the current Daemons variable
current_list=$(cat /etc/rc.conf | grep DAEMONS | cut -d'\(' -f2 | cut -d'\) -f1)
# Loop throu the list
for i in $current_list; do
# remove the first character if it's an @ or a !. This is because pattern matching doesn't work with them there.
current=$(echo $i | sed -e "s/^[@!]//")
# You could use if-else-statement here, but I like case and it likes regexps.
case $i in
case $i in
echo "DAEMONS=\($daemon_list $extra\)"
As I said above, highly untested
this will just output the DAEMON=() line so no worries about the rc.conf.
Recommended for a later date is just to sed the line like this
cp /etc/rc.conf /etc/rc.conf.org
sed -i "s/$(cat /etc/rc.conf | grep DAEMONS)/$new_daemon/" /etc/rc.conf