SID-01212: Using search to parse text
| Status: |
Answered |
TWiki version: |
|
Perl version: |
|
| Category: |
CategoryApplications |
Server OS: |
|
Last update: |
15 years ago |
Hi, I was wondering if there's a way to parse a block of text and send it to another page without having to install additional modules or packages.
Basically there's weekly meeting minutes, and I'd like to be able to chop it up according to topic.
I've searched a lot about using formatted search to do this but things have not really clicked, so much appreciated if you could give me some pointers.
Thanks.
--
WeiJiang - 2011-06-23
Discussion and Answer
You could simply enclose text you want to show in another page in
%STARTINCLUDE% and
%STOPINCLUDE%, then
%INCLUDE{}% that topic in another topic. You can also define multiple sections in a page and include the ones you need. See
VarINCLUDE,
VarSTARTINCLUDE,
VarSTARTSECTION.
You can also do a
FormattedSearch with a
RegularExpression $pattern() to search and pick specific text from a page.
--
PeterThoeny - 2011-06-23
Thanks! I'm using
$pattern(.*?(START.*?END*).*)
in a formatted search.
but it gets me "START blah blah blah END."
How do I exclude START and END and just get "blah blah blah?"
--
WeiJiang - 2011-06-24
$pattern(.*?START(.*?)END.*)
--
PeterThoeny - 2011-06-24
Fantastic. Thank you for your patience!
--
WeiJiang - 2011-06-24
How would one go about this sort of search with a variable name? For example, if I want to parse this:
Apple
a fruit that comes in red, yellow, green.
AppleEnd
Peach
has hair.
PeachEnd
Nectarines
doesn't have hair.
NectarinesEnd
Bananas
have potassium
BananasEnd
then insert what I get, i.e. "have potassium" into a row of a table corresponding to Banana.
--
WeiJiang - 2011-06-28
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.