LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Regular Expressions

[ILUG] Regular Expressions

Robert Sweetnam linux at sweetnam.eu
Tue Apr 1 21:51:54 IST 2008


Hi,

I'm using Squid on Ubuntu 7.10 (just to drag this vaguely on topic!) as 
a reverse proxy. All works very well and I can use Squid to block 
certain useragents instead of using htaccess on each site. However this 
is done using regex and is a feature that is supported by Squid. The 
only thing is when it comes to regular expressions I tend to blank out.

I have basic examples in place that will block the useragent based on 
its identifier. For example to block larbin I use ^larbin or for LibWWW 
perl I use ^LibWWW.

However I would like to make things more specific like blocking 
purported version numbers or any of a number of criteria made up from 
the useragent but my regex ability is dismally weak. For instance how 
would I set about blocking a useragent that contains say Opera, MSIE 6.0 
and ru in the string? This is an example that just recently attempted to 
spam my site:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; ru) Opera 8.50

Any suggestions would be greatly appreciated.

Cheers
Robert




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell