regex - Regular Expression to filter subdomains starting with www -


i need regular expression filters subdomains starting www. redirect them same subdomain without www.

so need filter urls more 3 dots in domain name , start www.:

when http_request {     if { [http::uri] matches_regex "**?????????????**" } {         //*     } else {         //* else      }  } 

test case:

www.subdomain.domain.com should converted subdomain.domain.com.

i don't have experience regular expressions, if has clue helpful.

i think want:

^www(\.[^\/\?\n]*){3} 

tested here few inputs.


explanations

^www matches 3 w @ beginning.

[^\/\?\n]* matches other marker of end of domain name (? may end domain name).

(\.[^\/\?\n]*){3} matches dot followed other end of domain name, 3 times. part ensure have subdomain (3 dots counting www.).


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -