[pmwiki-users] How to test IF name is 4 decimal ?

Petko Yotov 5ko at 5ko.fr
Tue Aug 8 04:28:39 CDT 2017


On 2017-08-08 11:03, ABClf wrote:
> Great. Thank you Petko.
> By the way, can you confirm pattern like [d] won't work for one decimal 
> ?

Just [d] means "d" or "D". Just [3] means "3". There is no [\d] digit or 
\w alphanumeric like in regular expressions, there is no "{4}" or "+" 
for repetition.

These patterns are not regular expressions patterns, but still offer 
flexibility and are easy to understand: * = "zero or more of any 
character" and ? = "exactly one any character".

You can have more than one pattern or page name, join them with commas, 
eg (:if name *-Users,*-Talk:).

And you can have negatives, place a minus before a page to be excluded: 
(:if name -*-Users,-*-Talk:).

The brackets are for more advanced usage.

Most people will probably simply need a page name without a pattern, 
like (:if name HomePage,SideBar:).

Petko

-- 
PmWeekly Blog  :  http://www.pmwiki.org/News
If you upgrade :  http://www.pmwiki.org/Upgrades



> 
> 2017-08-08 10:39 GMT+02:00 Petko Yotov <5ko at 5ko.fr>:
>> Something like this:
>> 
>> (:if name [0-9][0-9][0-9][0-9]:)
>> %green% Name is a 4-digit number.
>> (:else:)
>> %red% Name is NOT a 4-digit number.
>> (:if:)
>> 
>> You can have other characters like [a-z] for a range or [abc123] for
>> specific characters. This defines a single character in the page name 
>> that
>> is among those inside the brackets (case insentitive, but probably for 
>> a-z
>> letters only, not for international letters).
>> 
>> Petko
>> 
>> --
>> PmWeekly Blog  :  http://www.pmwiki.org/News
>> If you upgrade :  http://www.pmwiki.org/Upgrades
>> 
>> 
>> On 2017-08-08 10:25, ABClf wrote:
>>> 
>>> Hello,
>>> 
>>> I can't find what conditional markup is needed for testing if page
>>> name is like 1970 (made of 4 decimals).
>>> (:if name ????:) works, yet it's not restrictive enough for my need.
>>> Does anyone know the trick ?*



More information about the pmwiki-users mailing list