> >
META TOPICPARENT
name="FormattedSearch"
Search Pattern Cookbook
The Search function in TWiki is very powerful. Especially searches using a RegularExpression play an important part of tapping TWiki's full potential. Unfortunately RegularExpressions can be incredibly obscure to the uninitiated.
Most people not familiar (enough) with Regular Expressions mostly cut and paste (and maybe tweak) from existing examples. This page intends to collect lots of examples together.< < > > > > <-- ========================== -->
Pattern 1: Extract values from a table
Problem definition
<form>
<select> < < option1
option2
option3 > > option1
option2
option3
which is, in effect:
< < option1
option2
option3 > > option1
option2
option3
< < > >
<-- ========================== -->
Pattern 2: List generated from form classification
Problem
%SEARCH{"[T]opicClassification.*value\=.*Two;[T]opicStatus.*value\=.*%URLPARAM{type}%" < < regex="on" casesensitive="on" nosearch="on" > > type="regex" casesensitive="on" nosearch="on" format=" * $topic -
last modified by $wikiusername on $date
$formfield(TopicStatus ) " Filter:
< < %SEARCH{ "^\|[^\|]*\| *option *\|" topic="TopicClassification" web="TWiki" regex="on" > > %SEARCH{ "^\|[^\|]*\| *option *\|" topic="TopicClassification" web="TWiki" type="regex" multiple="on" nosearch="on" nototal="on" format="(.?) \|. )>$pattern(^\| (. ?) \|. ) " }%
All pages
This will create similar functionality as TWiki:Plugins.TopicClassificationAddOn < < > >
<-- ========================== -->
Pattern 3: Creating lists of TWiki usernames
Problem < < AbdelhakDjouadi
AbdenourLounis
AkimasaIshikawa
AldoDeandrea
AlexBradshaw
AlexanderAryshev
AlexanderKryukov
AlfonsoHylarides
AliceValkarova
AlinaGrigoras
AmaryZhang
AnaTeixeira
AnataelCabrera
AndreRubbia
AndreTilquin
AndreiDavydychev
AndreiTsaregorodtsev
AndrejArbusov
AndrewHaas
AndrewPurcell
AngTanFong
AngelesFausGolfe
AnneIsabelleEtienvre
AnnickLleres
AntoineKouchner
ArthurSchaffer
AurelienMartens
AxelNaumann
AyresFreitas
AzizMohd
BartolinoRoberto
BaudouyBertrand
BenjaminFuks
BenjaminQuilain
BernadetteFarizon
BerrieGiebels
BertaRubio
BertrandGirard
BijanSaghai
BinGong
BoLi
BoLiu
BorisHippolyte
BrigittePantat
BruceMellado
CarlBlaksley
CarolineHello
CatherineBerger
CatherineClerc
CecileRimbault
CedricCerna
ChanggenYang
ChaoWu
ChenghaiXu
ChenweiGONG
ChingRayChang
ChoosriKeedumrongkool
ChristianCOLLIEX
ChristianFinck
ChristianKiesling
ChristianKurrer
ChristineHu
ChristopheRossel
ClaraGaspar
ClaraNellist
ClaudeDuhr
ClaudiaArancibia
ClaudioGiganti
ClaudioTorres
CongfengQiao
CristinaCarloganu
DagmarAdamova
DanWang
DanielFOURNIER
DanielJeans
DanielMaitre
DanielSantos
DanieleNutarelli
DanyVandromme
DavidBritton
DavidLee
DavidLonguevergne
DavidSarramia
DenisBernard
DenisLB
DenisOliveiraDamazio
DenisPerretGallix
DepeiQian
DidierContardo
DietrichRTZahn
DikaiLi
DominiqueFouchez
DominiqueGuillemaudMueller
DongPhung
DongpilMin
DongsongZang
DorisKim
DorisNeumann
EdoardoMazzucato
EdouardBechetoille
EgleTG
EijiKako
EliBenHaim
EmiKou
EmikoNishimura
EnricoCenni
EphraimTabbert
EricKajfasz
EricKieffer
ErmingPei
ErnaKarule
EsthereGARNIER
EtienneAuge
EtienneParizot
EvgueniE
FabienEozenou
FabioZwirner
FabrizioGagliardi
FadiIbrahim
FaridahMohamadIdris
FedericoCarminati
FlorenceDiemer
FonsRademakers
FrazerCallaghan
FredericBenoliel
FredericJugeau
FredericKapusta
FredericPerrot
FrederiqueCHOLLET
FuShengYu
FukukoYuasa
GabrielChardin
GaelleBoudoul
GenevieveGilbert
GeorgeHou
GeorgesVasseur
GeorgyGolovanov
GeraldineFettahi
GiacomoCacciapaglia
GiacomoDeAngelis
GillesGerbier
GinesMartinez
GionataLuisoni
GiorgiGomelauri
GiorgioMaggi
GiovanniMarchiori
GiseleMartinChassard
GiulioDujany
GoIwai
GorazdCvetic
GordonWatts
GraemeAndrewStewart
GrigoryRubtsov
GudrunHeinrich
GuillaumeBatigne
HaolvFeng
HarrisonBProsper
HaruoNagai
HassanAbdoulCarime
HaygGuler
HaykHakobyan
HeinrichVoelk
HendrikFerdinande
HenriOrland
HerveKerret
HerveSato
HideakiTakabe
HiroIwasaki
HiroakiAihara
HirokazuIshino
HiroshiFukuda
HiroyaIshikawa
HiroyukiMatsunaga
HongXiao
HuanWang
HungLEQuang
HyeonsikCheong
IgnaciusStorey
IgorKondrashuk
IlleBernard
ImadLaktineh1
InSooKo
IndralPerera
InesBernaud
IoannisGiomataris
IonTiginyanu
IrynaChaikovska
IsaacWingrove
IsabelleRippBaudot
IsamuNakamura
IvoKoutsaroff
IwaiGo
JacquesDelabrouille
JacquesMartino
JeanChristopheHamilton
JeanLetang
JeanLucBiarrotte
JeanPhilippeLansberg
JeanYvesGrossiord
JeremyArgyriades
JeromeBaudot
JeromeLauret
JianxiongWang
JiaoZhang
JinWang
JincheolKim
JingWang
JingYuTang
JiriChudoba
JlBrenguier
JoseBusto
JoseOcariz
JosianeParnas
JosquinErrard
JulieMalcles
JulienBonis
JulienDonini
JuliettePlouin
JunGao
JunQingXia
JunpingTian
JunquanTao
KarimTrabelsi
KarlheinzMeier
KatsuoTokushuku
KazuhikoHara
KazunoriKohri
KazuoKitahara
KeisukeF
KeisukeFujii
KenSakashita
KenseiUmemori
KentaShigaki
KentaroMiuchi
KentarouMawatari
KimiyoIKEDA
KiyoshiKubo
KojiHara
KojiNakamura
KojiYoshimura
KunioInoue
LanZuoGillet
LaurentBrunetti
LaurentSerin
LaurentVacavant
LeiDang
LiChen
LianYou
LiangHAN
LilianaTeodorescu
LimingChen
LiuFuming
LiwenYao
LixinYan
LluisTorner
LorenzoMoneta
LuWang
LucLECALVEZ
LucPoggioli
LudwikDobrzynski
LuisSalinas
LukasFiala
MaciejKOLWAS
MadeleineSoyeur
ManobuTanaka
ManqiRuan
ManuelAguilar
MarcBesancon
MarcLachiezeRey
MarcosDracos
MargheritaBuizzaAvanzini
MariaGirone
MarieGermain
MarieHeleneGenest
MarieLaureGallinMartel
MariePierreCoquard
MarieThereseDONEL
MarineMoguenToursel
MarleneNahrgang
MarsollierA
MartialDucloy
MartinSpousta
MasahiroKuze
MasakiyoKitazawa
MasanoriSatoh
MasaoNinomiya
MasashiTakigawa
MasashiYokoyama
MasatoshiArai
MasatoshiNamiki
MathieuBongrand
MatteoBarsuglia
MatthiasKasemann
MatthieuReichstadt
MengWang
MichaelKagan
MichaelMarthaler
MichaelineWierzba
MichalMalinsky
MichelFarizon
MichelleSimmons
MikaMasuzawa
MilosLokajicek
MinFu
MingQi
MisaMiyai
MisamiYokoyama
MitsueNoji
MohammedFouaidy
MokraneDahoumane
MoniqueWerlen
MuhsinHarakeh
MurielFallot
NaohitoSaito
NathalieSeguinMoreau
NgoTranAnh
NicolasALAMANOS
NicolasChanon
NicolasDelerue
NicolasSpalinger
NicoleBastid
NigelGlover
NikoNeufeld
NikolaiRussakovich
NinaTumova
NobuKatayama
NobuhiroKIMURA
NobuhiroTerunuma
NobutakeNiita
NoorButt
OkHwanByeon
OlivierDeligny
OlivierMartineauHuynh
OsamuHashimoto
PAPhiNghiem
PanZhaot
PanZhaoting
PanZt
PatriceVerdier
PatriciaMendezLorenzo
PaulMahon
PeteJones
PeterJones
PeterUwer
PhilippeChomaz
PhuAnhPhiNghiem
PierreDESTRUEL
PierrePetroff
PierreSalati
PierreVanhove
PrabhakarDhekne
PushpaBhat
RachidGuernane
RadekStompor
RadjaBoughezal
RafaelSaldana
RaffaeleFlaminio
RaffySaldana
RaouxDenis
RaphaelTieulent
RashmiRaniwala
RauzahHashim
RaynienKwo
RebaChastain
RemiCornat
ReneBrun
RezaAnsari
RitsukoOta
RobertCHEHAB
RobertKirbyHarris
RobertoBonciani
RobertoLeon
RollaP
RomanPoeschl
RowenaSirey
RyoichiBaba
SabineKraml
SachaDavidson
SadaharuUeHara
SadyeFrench
SalmonConstable
SamiraHassani
SampadaKulkarni
SamuliHemming
SandroScandolo
SaraBolognesi
SatoruYamada
SatoshiMihara
SchuckP
SebastienDescotesGenon
SergeiGleyzer
SergeiKilin
SergeyBarsuk
SergeyKuleshov
SergiyNedilko
SergueiGanjour
SeungJooLEE
SeunghwanKim
ShanLiu
ShihChiehHsu
ShojiNagamiya
ShouzhuZhang
ShuLi
ShuangGUO
ShujiMiyamoto
SilvesterMadl
SmaragdaSpyrou
SofiaVallecorsa
SoichiroNishimura
SooHyeonNam
SpChia
StefanoRusso
StellaShen
StephenJones
SudhirRaniwala
SuhaimiNapis
SunKeeKim
SunchanJeong
SurendraChand
SverreJarp
SydneyGales
SylvainDavid
SylvieDagoret
TaddeuszPresti
TakahiroUeda
TakashiKaneko
TakayukiSAEKI
TakeshiDohmae
TakuyaHasegawa
TanCaoDang
TanakaManobu
TatsuyaChujo
TatsuyaNakada
ThomasBinoth
ThomasProslier
ThomasSpeer
TiejunDeng
TobyBurnett
TohruMotobayashi
TohruTakahashi
TomoakiNakamura
TordRiemann
TravisDario
TsutomuMibe
TsuyoshiSuwada
TuckerSochovka
TyshawnShawn
UedaKen
UnknownUnknown
UrbanoSundar
UrsulaBassler
ValeriFine
VasileDorobantu
VereneTruelove
ViacheslavKubytskyi
VincentTisserand
VirginaDeRaaf
VivianPoulin
VladimirDenisov
VladimirFortov
VladislavBalagura
WahidBhimji
WalidKaabi
WallaceLeuenberger
WanAhmadTajuddinWanAbdullah
WanTingChen
WeganMa
WeiLiu
WeiWANG
WeidongLi
WenyuanJin
WilliamBrooks
XiangdongJi
XiaodongZhang
XiaohuSun
XifengRuan
XinChen
XingLiu
XinhuaMA
XuaiZhuang
XuebinChi
XuefengWang
YajunMao
YanXiongbo
YangZheng
YannickGiraudHeraud
YanwenLiu
YasuchikaYamamoto
YasuoMIAKE
YaxianMao
YiRuan
YiWang
YinglanZhang
YongweiDong
YorkSchroder
YoshiakiFujii
YoshihideSakai
YoshimitsuShimizu
YoshinariHayato
YoshinoriEnomoto
YoshitakaKuno
YosukeAbe
YosukeHonda
YosukeTakubo
YuGangMA
YuNakahama
YujiEnari
YukariMatsuo
YulanLi
YumingWang
YutakaUshiroda
ZhanShi
ZhangWenchao
ZhangYifei
ZhaoDonghua
ZhaoxiZhang
ZhengguoZhao
ZhichaoZhan
ZianZhu
ZizhaoZong
ZsoltFulop
Number of topics: 521
<--/patternSearchResultCount-->
> > AbdelhakDjouadi
AbdenourLounis
AkimasaIshikawa
AldoDeandrea
AlexBradshaw
AlexanderAryshev
AlexanderKryukov
AlfonsoHylarides
AliceValkarova
AlinaGrigoras
AmaryZhang
AnaTeixeira
AnataelCabrera
AndreRubbia
AndreTilquin
AndreiDavydychev
AndreiTsaregorodtsev
AndrejArbusov
AndrewHaas
AndrewPurcell
AngTanFong
AngelesFausGolfe
AnneIsabelleEtienvre
AnnickLleres
AntoineKouchner
ArthurSchaffer
AurelienMartens
AxelNaumann
AyresFreitas
AzizMohd
BartolinoRoberto
BaudouyBertrand
BenjaminFuks
BenjaminQuilain
BernadetteFarizon
BerrieGiebels
BertaRubio
BertrandGirard
BijanSaghai
BinGong
BoLi
BoLiu
BorisHippolyte
BrigittePantat
BruceMellado
CarlBlaksley
CarolineHello
CatherineBerger
CatherineClerc
CecileRimbault
CedricCerna
ChanggenYang
ChaoWu
ChenghaiXu
ChenweiGONG
ChingRayChang
ChoosriKeedumrongkool
ChristianCOLLIEX
ChristianFinck
ChristianKiesling
ChristianKurrer
ChristineHu
ChristopheRossel
ClaraGaspar
ClaraNellist
ClaudeDuhr
ClaudiaArancibia
ClaudioGiganti
ClaudioTorres
CongfengQiao
CristinaCarloganu
DagmarAdamova
DanWang
DanielFOURNIER
DanielJeans
DanielMaitre
DanielSantos
DanieleNutarelli
DanyVandromme
DavidBritton
DavidLee
DavidLonguevergne
DavidSarramia
DenisBernard
DenisLB
DenisOliveiraDamazio
DenisPerretGallix
DepeiQian
DidierContardo
DietrichRTZahn
DikaiLi
DominiqueFouchez
DominiqueGuillemaudMueller
DongPhung
DongpilMin
DongsongZang
DorisKim
DorisNeumann
EdoardoMazzucato
EdouardBechetoille
EgleTG
EijiKako
EliBenHaim
EmiKou
EmikoNishimura
EnricoCenni
EphraimTabbert
EricKajfasz
EricKieffer
ErmingPei
ErnaKarule
EsthereGARNIER
EtienneAuge
EtienneParizot
EvgueniE
FabienEozenou
FabioZwirner
FabrizioGagliardi
FadiIbrahim
FaridahMohamadIdris
FedericoCarminati
FlorenceDiemer
FonsRademakers
FrazerCallaghan
FredericBenoliel
FredericJugeau
FredericKapusta
FredericPerrot
FrederiqueCHOLLET
FuShengYu
FukukoYuasa
GabrielChardin
GaelleBoudoul
GenevieveGilbert
GeorgeHou
GeorgesVasseur
GeorgyGolovanov
GeraldineFettahi
GiacomoCacciapaglia
GiacomoDeAngelis
GillesGerbier
GinesMartinez
GionataLuisoni
GiorgiGomelauri
GiorgioMaggi
GiovanniMarchiori
GiseleMartinChassard
GiulioDujany
GoIwai
GorazdCvetic
GordonWatts
GraemeAndrewStewart
GrigoryRubtsov
GudrunHeinrich
GuillaumeBatigne
HaolvFeng
HarrisonBProsper
HaruoNagai
HassanAbdoulCarime
HaygGuler
HaykHakobyan
HeinrichVoelk
HendrikFerdinande
HenriOrland
HerveKerret
HerveSato
HideakiTakabe
HiroIwasaki
HiroakiAihara
HirokazuIshino
HiroshiFukuda
HiroyaIshikawa
HiroyukiMatsunaga
HongXiao
HuanWang
HungLEQuang
HyeonsikCheong
IgnaciusStorey
IgorKondrashuk
IlleBernard
ImadLaktineh1
InSooKo
IndralPerera
InesBernaud
IoannisGiomataris
IonTiginyanu
IrynaChaikovska
IsaacWingrove
IsabelleRippBaudot
IsamuNakamura
IvoKoutsaroff
IwaiGo
JacquesDelabrouille
JacquesMartino
JeanChristopheHamilton
JeanLetang
JeanLucBiarrotte
JeanPhilippeLansberg
JeanYvesGrossiord
JeremyArgyriades
JeromeBaudot
JeromeLauret
JianxiongWang
JiaoZhang
JinWang
JincheolKim
JingWang
JingYuTang
JiriChudoba
JlBrenguier
JoseBusto
JoseOcariz
JosianeParnas
JosquinErrard
JulieMalcles
JulienBonis
JulienDonini
JuliettePlouin
JunGao
JunQingXia
JunpingTian
JunquanTao
KarimTrabelsi
KarlheinzMeier
KatsuoTokushuku
KazuhikoHara
KazunoriKohri
KazuoKitahara
KeisukeF
KeisukeFujii
KenSakashita
KenseiUmemori
KentaShigaki
KentaroMiuchi
KentarouMawatari
KimiyoIKEDA
KiyoshiKubo
KojiHara
KojiNakamura
KojiYoshimura
KunioInoue
LanZuoGillet
LaurentBrunetti
LaurentSerin
LaurentVacavant
LeiDang
LiChen
LianYou
LiangHAN
LilianaTeodorescu
LimingChen
LiuFuming
LiwenYao
LixinYan
LluisTorner
LorenzoMoneta
LuWang
LucLECALVEZ
LucPoggioli
LudwikDobrzynski
LuisSalinas
LukasFiala
MaciejKOLWAS
MadeleineSoyeur
ManobuTanaka
ManqiRuan
ManuelAguilar
MarcBesancon
MarcLachiezeRey
MarcosDracos
MargheritaBuizzaAvanzini
MariaGirone
MarieGermain
MarieHeleneGenest
MarieLaureGallinMartel
MariePierreCoquard
MarieThereseDONEL
MarineMoguenToursel
MarleneNahrgang
MarsollierA
MartialDucloy
MartinSpousta
MasahiroKuze
MasakiyoKitazawa
MasanoriSatoh
MasaoNinomiya
MasashiTakigawa
MasashiYokoyama
MasatoshiArai
MasatoshiNamiki
MathieuBongrand
MatteoBarsuglia
MatthiasKasemann
MatthieuReichstadt
MengWang
MichaelKagan
MichaelMarthaler
MichaelineWierzba
MichalMalinsky
MichelFarizon
MichelleSimmons
MikaMasuzawa
MilosLokajicek
MinFu
MingQi
MisaMiyai
MisamiYokoyama
MitsueNoji
MohammedFouaidy
MokraneDahoumane
MoniqueWerlen
MuhsinHarakeh
MurielFallot
NaohitoSaito
NathalieSeguinMoreau
NgoTranAnh
NicolasALAMANOS
NicolasChanon
NicolasDelerue
NicolasSpalinger
NicoleBastid
NigelGlover
NikoNeufeld
NikolaiRussakovich
NinaTumova
NobuKatayama
NobuhiroKIMURA
NobuhiroTerunuma
NobutakeNiita
NoorButt
OkHwanByeon
OlivierDeligny
OlivierMartineauHuynh
OsamuHashimoto
PAPhiNghiem
PanZhaot
PanZhaoting
PanZt
PatriceVerdier
PatriciaMendezLorenzo
PaulMahon
PeteJones
PeterJones
PeterUwer
PhilippeChomaz
PhuAnhPhiNghiem
PierreDESTRUEL
PierrePetroff
PierreSalati
PierreVanhove
PrabhakarDhekne
PushpaBhat
RachidGuernane
RadekStompor
RadjaBoughezal
RafaelSaldana
RaffaeleFlaminio
RaffySaldana
RaouxDenis
RaphaelTieulent
RashmiRaniwala
RauzahHashim
RaynienKwo
RebaChastain
RemiCornat
ReneBrun
RezaAnsari
RitsukoOta
RobertCHEHAB
RobertKirbyHarris
RobertoBonciani
RobertoLeon
RollaP
RomanPoeschl
RowenaSirey
RyoichiBaba
SabineKraml
SachaDavidson
SadaharuUeHara
SadyeFrench
SalmonConstable
SamiraHassani
SampadaKulkarni
SamuliHemming
SandroScandolo
SaraBolognesi
SatoruYamada
SatoshiMihara
SchuckP
SebastienDescotesGenon
SergeiGleyzer
SergeiKilin
SergeyBarsuk
SergeyKuleshov
SergiyNedilko
SergueiGanjour
SeungJooLEE
SeunghwanKim
ShanLiu
ShihChiehHsu
ShojiNagamiya
ShouzhuZhang
ShuLi
ShuangGUO
ShujiMiyamoto
SilvesterMadl
SmaragdaSpyrou
SofiaVallecorsa
SoichiroNishimura
SooHyeonNam
SpChia
StefanoRusso
StellaShen
StephenJones
SudhirRaniwala
SuhaimiNapis
SunKeeKim
SunchanJeong
SurendraChand
SverreJarp
SydneyGales
SylvainDavid
SylvieDagoret
TaddeuszPresti
TakahiroUeda
TakashiKaneko
TakayukiSAEKI
TakeshiDohmae
TakuyaHasegawa
TanCaoDang
TanakaManobu
TatsuyaChujo
TatsuyaNakada
ThomasBinoth
ThomasProslier
ThomasSpeer
TiejunDeng
TobyBurnett
TohruMotobayashi
TohruTakahashi
TomoakiNakamura
TordRiemann
TravisDario
TsutomuMibe
TsuyoshiSuwada
TuckerSochovka
TyshawnShawn
UedaKen
UnknownUnknown
UrbanoSundar
UrsulaBassler
ValeriFine
VasileDorobantu
VereneTruelove
ViacheslavKubytskyi
VincentTisserand
VirginaDeRaaf
VivianPoulin
VladimirDenisov
VladimirFortov
VladislavBalagura
WahidBhimji
WalidKaabi
WallaceLeuenberger
WanAhmadTajuddinWanAbdullah
WanTingChen
WeganMa
WeiLiu
WeiWANG
WeidongLi
WenyuanJin
WilliamBrooks
XiangdongJi
XiaodongZhang
XiaohuSun
XifengRuan
XinChen
XingLiu
XinhuaMA
XuaiZhuang
XuebinChi
XuefengWang
YajunMao
YanXiongbo
YangZheng
YannickGiraudHeraud
YanwenLiu
YasuchikaYamamoto
YasuoMIAKE
YaxianMao
YiRuan
YiWang
YinglanZhang
YongweiDong
YorkSchroder
YoshiakiFujii
YoshihideSakai
YoshimitsuShimizu
YoshinariHayato
YoshinoriEnomoto
YoshitakaKuno
YosukeAbe
YosukeHonda
YosukeTakubo
YuGangMA
YuNakahama
YujiEnari
YukariMatsuo
YulanLi
YumingWang
YutakaUshiroda
ZhanShi
ZhangWenchao
ZhangYifei
ZhaoDonghua
ZhaoxiZhang
ZhengguoZhao
ZhichaoZhan
ZianZhu
ZizhaoZong
ZsoltFulop
Number of topics: 521
<--/patternSearchResultCount-->
META:FORM.*[U]serForm will search for all topics with a UserForm attached - change this if you have a different form where userdata is stored. Please note that this search does not actually extract anything from the form - it just uses it to identify the appropriate pages
excludetopic="Test*, TWiki*" allows to skip all topics starting with Test and TWiki, such as TestUser or TWikiAdmin. Use this if you have any special users who you do not want appearing in this list
> >
<-- ========================== -->
Pattern 4: Extract the parent of a given topic
Problem
How to get to the parent of the current topic to display on the page?< < Solution > > Solution 1: Using META
Since TWiki 4.0 you can now use the META variable:
%META{ "parent" dontrecurse="on" }%
Solution 2: Using SpreadSheetPlugin
You might think that the following Search would do the trick: < < parent_link > > < < However, the [[$parent][parent_link]] link fails if the topic has no parent set ($parent will be empty). You can use some SpreadSheetPlugin magic to conditionally link to the parent or to WebHome: [[$percntCALC{$IF($EXACT($parent,), %HOMETOPIC%, $parent)}$percnt][parent_link]] > > However, the $parent link fails if the topic has no parent set ($parent will be empty). You can use some TWiki:Plugins/SpreadSheetPlugin magic to conditionally link to the parent or to WebHome:
$percntCALC{$IF($EXACT($parent,),<nop>,$NOP( * $parent))}$percnt
So the total Search query to find a topic's parent topic is: < < [[FormattedSearch][parent_link]] > >
Test Case
The parent topic of this topic is:
Solution 3: Using IF statement
This pattern can be rewritten using %IF%, removing the dependency on SpreadSheetPlugin:
%SEARCH{ "^%BASETOPIC%$" web="%BASEWEB%" scope="topic" type="regex" nonoise="on" format="$percntIF{$quot$parent$quot then=$quot * $parent$quot else=$quot<nop>$quot}$percnt" }% < < Test Case
The parent topic of this topic is: FormattedSearch > > Test Case
The parent topic of this topic is:
< < Pattern 5: Search and display the home topics of public webs in a list > >
<-- ========================== -->
Pattern 5: Show all Children of a given topic
Problem
How to get to the list of all children of the current topic to display on the page?
Solution
The parent information is stored in the META:TOPICPARENT meta data. Do a SEARCH to find all topic parent meta data pointing to the current topic:
Children:
%SEARCH{ "META\:TOPICPARENT.*\"%TOPIC%\"" type="regex" nonoise="on" format="[[$topic]]" separator=", " }%
Note: Replace %TOPIC% with %BASETOPIC% if you put this SEARCH into the skin or a sidebar.
<-- ========================== -->
Pattern 6: Search and display the home topics of public webs in a list
Problem
< < Pattern 6: Extract a value from a bullet list > >
<-- ========================== -->
Pattern 7: Create a select box with values from a bullet list
Problem
We have a topic with a bullet list with category names. In another topic we want to offer these values in a select box dropdown.
For example, CategoryList has:
Clients
People
Rooms
Buildings
Solution
The following search pattern can be employed:
<select name="type">
<option>Select category...</option>
%SEARCH{" *\s*.*?" topic="CategoryList" type="regex" multiple="on" casesensitive="on" nosummary="on" nosearch="on" noheader="on" nototal="on" format="<option>$pattern(.* \*\s*([^\n]*).*)</option>"}%
</select>
To render the bullet list as a comma-separated list, use the separator parameter:
%SEARCH{" *\s*.*?" topic="CategoryList" type="regex" multiple="on" casesensitive="on" nosummary="on" nosearch="on" noheader="on" nototal="on" separator="," format="$pattern(.* \*\s*([^\n]*).*)"}%
<-- ========================== -->
Pattern 8: Extract a value from a named bullet list item
Problem Search for the Name: entry. < < > >
Test case
Search result: < < > >
<-- ========================== -->
Pattern 9: Search for Form and Meta data: explained < < Pattern 7: Search for Form and Meta data: explained Problem > > Below is an example of a search that searches form data. The questions are:
why is this searching the metadata, shouldn't it just search the text?
what is the meaning of the td..td in the search expression?
what is the meaning of the td..td in the search expression?
< < %SEARCH{ "[S]tatus.*(td..td|value\=).*[W]aiting" casesensitive="on" regex="on" > > %SEARCH{ "[S]tatus.*(td..td|value\=).*[W]aiting" casesensitive="on" type="regex" nosearch="on" nototal="on" format="| $topic <br /> ($date - $rev -
Diffs ) |"}%
So a search for a form field could look like:
< < %SEARCH{ "[O]peratingSystem.*value\=.*[O]sWin" regex="on" ... }% > > %SEARCH{ "[O]peratingSystem.*value\=.*[O]sWin" type="regex" ... }%
Using square brackets is a trick to avoid a hit on the topic doing the search.
The .* indicate that there can be any number of any character between OperatingSystem and value in the (whole) file
The following search finds topics in the old and new format:
< < %SEARCH{ "[O]peratingSystem.*(td..td|value\=).*[O]sWin" regex="on" ... }% > > %SEARCH{ "[O]peratingSystem.*(td..td|value\=).*[O]sWin" type="regex" ... }%
The td..td matches td<>td; a simple search on "[O]peratingSystem.*[O]sWin" could find a hit in the topic text by coincidence.
A simple %SEARCH{ "[O]peratingSystem.*value\=.*[O]sWin" ...}% search is sufficient if you do not have topics in the old format. < < Pattern 8: Search all topics that have been moved > >
<-- ========================== -->
Pattern 10: Search all topics that have been moved Problem > > How would I go about listing all moved topics ?
Solution How would I go about listing all moved topics ?
Solution > > Search for the META:TOPICMOVED meta data. Type this: < < Moved topics: %SEARCH{ "%META\:TOPICMOVED" regex="on" format="$topic, " nosearch="on" noheader="on" nosummary="on" }%> > Moved topics: %SEARCH{ "%META\:TOPICMOVED" type="regex" format="$topic, " nosearch="on" noheader="on" nosummary="on" }%
to get this (limited to 10 results): < < Moved topics: Number of topics: 0
<--/patternSearchResultCount-->
Contributors > > Moved topics: Number of topics: 0
<--/patternSearchResultCount-->
< < TWiki:Main.AntonAylward , TWiki:Main.ArthurClemens , TWiki:Main.JosMaccabiani , TWiki:Main.PeterThoeny , TWiki:Main.SueLocke > > Related Topics: UserDocumentationCategory , SearchHelp , TWikiVariables#VarSEARCH , FormattedSearch , RegularExpression < < Related Topics: UserDocumentationCategory > > -- Contributors: TWiki:Main.AntonAylward , TWiki:Main.ArthurClemens , TWiki:Main.JosMaccabiani , TWiki:Main.PeterThoeny , TWiki:Main.SueLocke