Forum Discussion
johnscr_45871
Nimbostratus
Dec 12, 2008Simple match of URL based on regular expression
Hi
I am haveing some trouble with this simple Irule and was hoping someone could help. All I have to do is check the incomming URL and see if it matches a reg ex. If it matches the reg ex, then pass the request on to "PoolB".
The regular expression (as one of my devs has writtin it) looks like this:
(.*)?postcode=(.*)&email=(.*)
The incomming url will look like this:
http://www.bla.com/folder1/?postcode=POSTCODE&email=EMAIL
where POSTCODE is an actual postcode and EMAIL is an actual email address.
I know this should be simple but I just cant get it working??
Any help will be met with massive amounts of karma, respect, love and chocolate covered goodies.
Thanks
3 Replies
Sort By
- hoolio
Cirrostratus
Hi there,when HTTP_REQUEST { Check if the query string contains anything postcode anything email anything or anything email anything postcode if {([string match *postcode=*email=* [HTTP::query]] or [string match *email=*postcode=* [HTTP::query]])}{ Query string matched, so use PoolB pool PoolB } else { Query string did not match, so use PoolA pool PoolA } }
when HTTP_REQUEST { Check if the query string contains the postcode and email email parameters with lengths if {([string length [URI::query [HTTP::query] postcode]] and [string length [URI::query [HTTP::query] email]])}{ Query string matched, so use PoolB pool PoolB } else { Query string did not match, so use PoolA pool PoolA } }
- johnscr_45871
Nimbostratus
So after some persistance I got this one to work. I hope its doing the correct thing, but initial testing looks OK. - johnscr_45871
Nimbostratus
Thanks Hoolio
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects