[pmwiki-users] regex in (:if how to use correctly - solved

lists at basel-inside.ch lists at basel-inside.ch
Fri Jan 24 04:45:23 CST 2014


Thank you very much for your hints concerning regexp, it works now for me.

As I'm using the expression in a pagelist template I'm not shure whether
(:if match ^\d :)  refers to the correct page (refers to current page).
So I implemented matchstring. (Cookbook/ConditionalMarkupSamples)
this works in pagelist:
(:if2 matchstring '/^Carpet.[0-9]{5}/' '{=$FullName}' :)

---- Template for rendering Pictures --
-- I avoided the breaks between picture with a surrounding
-- <div style="float: left"> as it still generates <br />
!!Gallerie-Darstellungen  m i n i  /pog
(:if false:)
[[#galleryPicOnlyMini]]
(:template first:)
(:template each:)
(:comment Vars in List: {*$FullName} -->{=$FullName} / {*$Page} / {*$Name} :)
(:if2 matchstring '/^Carpet.[0-9]{5}/' '{=$FullName}' :)
(:div class="gallery" style="float: left; margin-top:50px;  
margin-left: 20px":)
[==]{=$Description}
(:divend:)
(:if2end:)
(:template last:)
[[#galleryPicOnlyMiniend]]
(:templateend:)
>> <<
(:ifend:)
------- end template

Zitat von "Patrick R. Michaud" <pmichaud at pobox.com>:

> On Thu, Jan 23, 2014 at 08:45:42PM +0100, lists at basel-inside.ch wrote:
>> Good evening
>>
>> I like to only include some pages in a pagelist, I have seen the
>> possiblity of regexp as
>> (:if match -Talk$:)  [PmWiki/ConditionalMarkup-Talk]
>>
>> I'm not very familar with regexp and (:if constructions
>> I made one test with (:if match [0-9]* :-) in the hope to selekt
>> everything which beginns with numeric, but it seems to be
>> uncorrect...
>
> Everything that begins with numeric:
>
>     (:if match ^\d :)
>   or
>     (:if match ^[0-9] :)
>
>> Actually I like to select
>> =>00001mmmm   (5 Numbers Product-Nr and n letters for variations/tests)
>
> Everything that starts with five digits:
>
>     (:if match ^\d{5} :)
>   or
>     (:if match ^[0-9]{5} :)
>
> Pm
>






More information about the pmwiki-users mailing list