Forum Discussion
hooleylist
Nov 14, 2011Cirrostratus
Jucao,
What are you actually trying to do? Do you want to see if an HTTP path ends with a set of extensions?
If so, you could either use a switch statement or the class command with the ends_with operator and a datagroup. There isn't a logical way to combine a switch statement and a class lookup in one operation. From Joe's testing, a datagroup is probably more efficient than a switch statement if you consider matches in the beginning, middle and end of the list of strings:
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/1086424/Comparing-iRule-Control-Statements.aspx
However, when using a small list of strings (<100) the results are close enough that it probably makes sense to choose a switch statement if it's easier for you to manage the strings inline within the iRule instead of in a datagroup.
Aaron