Tags:
create new tag
view all tags

Question

How would I be able to extract data from WebStatistics (only the 'Topic Views' section of the table) using a regex in TWiki?

Environment

TWiki version: TWikiRelease01Dec2001
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Linux 2.4.18-686-smp
Web server: Apache
Perl version: perl, v5.8.3
Client OS: MS Windows 2K SP4
Web Browser: Internet Explorer, Mozilla Firefox

-- VivekDelhikar - 18 Feb 2004

Answer

Ok... I've figured it out, the regex would look like:

%INCLUDE{"%STATISTICSTOPIC%" pattern=".*?\-\-statTopContributors\-\-\>[^\|]+\|[^\|]+\|[^\|]+\|[^\|]+\|[^\|]+\|[^\|]+(\|[^\|]+\|[^\|]+\|).*"}%

However, how would I be able to exclude topics such as WebHome using the regex I've got above?

-- VivekDelhikar - 19 Feb 2004

Write this to get the all topics:

%INCLUDE{"%STATISTICSTOPIC%" pattern=".*?\-\-statTopContributors\-\-\>[^\r\n]+[\r\n]+\|[^\|]+\|[^\|]+\|[^\|]+\|[^\|]+([^\r\n]+).*"}%

This renders as:

2181 InsertLinkHere
1358 WebHome
  738 PhpFlagEngineOffBreaksRendering
  731 HowToShowPageVisitorCount
  354 SID-02382
  296 AskedAndAssignedQuestions
  216 WebNotify
  197 SID-02222
  178 WebChanges
  170 SupportGuidelines
 

You can skip anything up to and including WebHome. Notice that this regex is kind of flaky, it assumes that the WebHome topic is there and that anything more popular is noise:

|%INCLUDE{"%STATISTICSTOPIC%" pattern=".*?\-\-statTopContributors\-\-\>[^\r\n]+[\r\n]+.*?WebHome[^0-9]*([^\r\n]+).*"}%

This renders as:

738 PhpFlagEngineOffBreaksRendering
  731 HowToShowPageVisitorCount
  354 SID-02382
  296 AskedAndAssignedQuestions
  216 WebNotify
  197 SID-02222
  178 WebChanges
  170 SupportGuidelines
 

-- PeterThoeny - 05 May 2004

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2004-05-05 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.