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:

3114 InsertLinkHere
2958 WebHome
2276 SID-02382
  481 AskedAndAssignedQuestions
  445 WebNotify
  378 SupportGuidelines
  370 WebChanges
  357 WebSearch
  324 SupportForum
  278 SID-02372
 

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:

2276 SID-02382
  481 AskedAndAssignedQuestions
  445 WebNotify
  378 SupportGuidelines
  370 WebChanges
  357 WebSearch
  324 SupportForum
  278 SID-02372
 

-- 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.