Forum Discussion
youssef1
Sep 05, 2018Cumulonimbus
Hi Dev,
I write and tested this irule with success:
Your example: http://www.hostname.com/uripath/sn=1234567890/abouttoopenhomepage.docx
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
retrieve SN Value
set SN_value [findstr $uri /sn= 4 /]
log local0. "$SN_value"
define if SN_value is digit (catch error if not digit)
if { [catch {
regexp {^([0-9]+)$} $SN_value -> value
log local0. "cn value = $value is a digit"
set digit 1 } ] } {
set digit 0
log local0. "cn value is not only digit"
}
if {[string length $SN_value] == 10 && $digit == 1 && ($uri ends_with ".docx" || $uri ends_with ".xlsx")} {
log local0. "cn value is a digit and is lenght is not more than 10 and not less than 10 digit "
}
}
Keep me in touch and if you need more details don't hesitate.
regards