Forum Moderators: phranque

Message Too Old, No Replies

REGEX simple syntax ...

... help needed

         

le_gber

10:05 am on Feb 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi all,

just a quick one

if I wanted to exclude a domain name from my stats using regex how would I go about it?

let's say the domain is excludeddomain.com and I want to skip every request from it's subdomain as well (ie. sub1.excludeddomain.com ; sub2.excludeddomain.com ...)

would this remove all of them?

REGEX[^\.exludeddomain\.com$]

Thanks guys/gals

Leo

Caterham

8:52 pm on Feb 26, 2005 (gmt 0)

10+ Year Member



you can use
REGEX[exludeddomain\.com]

or

REGEX[^.*exludeddomain\.com]

this will also exclude excludedomain.com wihout a sublevel present

le_gber

9:53 am on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Caterham

that didn't seem to work.

Regards,

Leo

le_gber

2:33 pm on Mar 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi All,

some more info about my problem - might help you help me :)

It's basically the SkipHosts function in awstats that I want to tweak. I want to remove the automatic accessibility checks that are run every month from my stats.

as an example on how to use it - the developer gave this:

# Example: "REGEX[^.*\.localdomain$]"

I am just not sure how to modify this function to exlude subdomains as well (may be they already are).

Could you also tell me the purpose of the $ sign? is it use to match any TLD?

Thanks for your help - it is much appreciated.

Leo

jdMorgan

3:28 pm on Mar 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If that is a normal regular expression and not some AWStats-specific notation, then "^" means "beginning with" and "$" means "ends with". These are referred to as "start anchor" and an "end anchor" respectively.

The patterns Caterham gave you should match any subdomain, because ".*" means "match anything", and omitting the start anchor is equivalent to anchoring a pattern starting with ".*".

More information on regular expressions is available in the tutorial cited in our forum charter.

Another question is what does this AWStats code exclude? If you wish to exclude referrers and the code is intended to exclude server hostnames, then the pattern may be working, but it is not checking the class of variable you expect it to.

Jim

le_gber

8:50 pm on Mar 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jdMorgan,

I'll have a read throught the forum charter and try to sort this out.

Thanks again.

Leo