Forum Discussion
Jan 03, 2007
Stay away from regular expressions if you can at all help it. Using the switch statement with file globbing (-glob) or the starts_with/ends_with/contains operators can cover most of the cases where users use regular expressions. In your case you are just doing a straight string compare so regular expressions are way overkill.
Here's an example of your rule using the switch statement.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"demo.nature.com" {
pool demo
}
"xml.nature.com" -
"palgravexml.nature.com" {
pool Autonomy
}
default {
discard
}
}
}
-Joe