Tags:
create new tag
view all tags

Question

I want to use %SEARCH{...}% variable to extract contents from all the topics with the same formatted table, how can i do this? Thanks! e.g. Table format of topics is like this:

Project Name Linux Engineering
Status Updates Done
Action Owner April and Lisa

Project Name PHP
Status Updates Done
Action Owner April


Project Name Java
Status Updates Done
Action Owner Lily


  • I want to extract Project Name info from all the topics with the same formatted table.

  • I want to get the result like this:
Project Name List
Linux Engineering
Java
PHP
...

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Redhat update3
Web server: Apache
Perl version:  
Client OS: WindowXP
Web Browser: Firefox
Categories: Search

-- ShashaLuan - 05 Jun 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Do a FormattedSearch with a regular expression. Here is an example that pulls the project names from the tables in this topic.

Project Name List
Linux Engineering
PHP
Java

Look at the raw text to see how it works. For your own use remove topic="%TOPIC%".

-- PeterThoeny - 06 Jun 2006

Consider also using TWikiForms based applications. Data entry and reporting is much easier.

-- PeterThoeny - 06 Jun 2006

This is great. What would the regex for this example look like?

Veranstaltung Beginn Ende Beschreibung
abc 12:00 18:00 lorem dolor ipsum
def 17:00 19:00 lorem dolor ipsum
ghi 12:00 18:00 lorem dolor ipsum
jkl 09:00 18:00 lorem dolor ipsum
mno 22:00 23:30 lorem dolor ipsum
pqr 12:00 18:00 lorem dolor ipsum
stu 14:00 18:00 lorem dolor ipsum
vwx 18:00 21:00 lorem dolor ipsum

I would like to display the lets say last 5 entries from the table above. I couldn't manage to include the table as it is part of CommentPlugin user template so I am looking for some regex...

-- CarloSchulz - 10 Jun 2008

Tree possibilities (as far as I remember). Have a look at

  1. $pattern() from standard %SEARCH{...}%
  2. %EXTACT{...}% from FilterPlugin
  3. %TABLEDATA{...}% from RenderTableDataPlugin

(1)+(2) need an appropriate regular expression to match the table row you want (something like \|\s*(.*?)\s*\|\s*(.*?)\s*\|....) (3) is more comfortable, see its docu.

-- MichaelDaum - 11 Jun 2008

Carlo, actually, to get the last 5 table rows you can simply do a pattern SEARCH that captures the 5 lines above a marker. I added <!--EOT--> at the end of your example table. Here is the extraction:

jkl 09:00 18:00 lorem dolor ipsum
mno 22:00 23:30 lorem dolor ipsum
pqr 12:00 18:00 lorem dolor ipsum
stu 14:00 18:00 lorem dolor ipsum
vwx 18:00 21:00 lorem dolor ipsum

-- PeterThoeny - 12 Jun 2008

Awesome, thank you guys smile

-- CarloSchulz - 15 Jun 2008

-- PrathibaRao - 02 Jul 2008

I seem to be having problem in writing a search function for getting result similar to question asked here. I write Search: [P]rojectName scope="text

This search gives me the entire table i.e all columns and not the particular column and its values aseven though i have mentioned only ProjectName

Please help

-- PrathibaRao - 02 Jul 2008

I seem to be having problem in writing a search function for getting result similar to question asked here. I write Search: [P]rojectName scope="text

This search gives me the entire table i.e all columns and not the particular column and its values aseven though i have mentioned only ProjectName

Please help

-- PrathibaRao - 02 Jul 2008

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2008-07-02 - PrathibaRao
 
  • 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.