Forum Discussion
iRule - escape period in Double Quotes,Braces
I hope your help. I want to know to escape period in Double Quotes. I'm trying to write irule. But I can't understand to escape period in Double Quotes.
If HTTP request is "http://test.co.jp/aahtmlaa" , in iRule1 the request goes to pool_A, in iRule2 the request goes to pool_B.
If HTTP request is "http://test.co.jp/aa.htmlaa" , in iRule1 the request goes to pool_A, in iRule2 the request goes to pool_A.
Escape period doesn't effect in iRule1. iRule1 and iRule2 differ in Delimiters.iRule1 uses "".iRule2 uses {}.
I read this article. https://devcentral.f5.com/articles/irules-optimization-101-04-delimiters-braces-brackets-quotes-and-more.Uu7qIKLWyzk I want to know to escape period in Double Quotes ,not Braces. Please help.
iRule 1.if { [HTTP::uri] matches_regex "\.(htm|html|css|js|png|gif|json|jpg|jpeg)"} { set Pool_Name pool_A } else { set Pool_Name pool_B }
iRule2.if { [HTTP::uri] matches_regex {\.(htm|html|css|js|png|gif|json|jpg|jpeg)}} { set Pool_Name pool_A } else { set Pool_Name pool_B }
Thanks!
3 Replies
- John_Alam_45640Historic F5 Account
Try this:
This evaluates to true when RULE_INIT { if { "aa.html" matches_regex "aa\\.html" } { log local0. "true" } else { log local0. "false" } } This evaluates to false: when RULE_INIT { if { "aahtml" matches_regex "aa\\.html" } { log local0. "true" } else { log local0. "false" } } This also evaluates to false: when RULE_INIT { if { "aa-html" matches_regex "aa\\.html" } { log local0. "true" } else { log local0. "false" } }- fuhi_30959
Nimbostratus
John Thank you very much! I will try this. - fuhi_30959
Nimbostratus
John It works! Thank you for your kindness.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com