'primefaces keyfilter regular expression

I got a problem regarding to the keyfilter from primefaces extension. I want to define a regular expression for a time period for example "P1Y3M2W1d". The following regular expression for the key filter is used:

<pe:keyFilter regEx="/P[0-9]*Y*[0-9]*M*[0-9]*W*[0-9]*d*/" />

The goal is that user might only type in P first then digit number 0-9, afterwards Y(year), M(Month) or W(Week) and so on. The problem is I can only type in captial P and nothing else. I check the regular expression. It is correct. What is the problem with regular expression in keyFilter? Thanks for help!!!

Update:

<p:inputText value="#{cc.attrs.value}" id="period" >
   <pe:keyFilter regEx="/P([0-9]+Y)?([0-9]+M)?([0-9]+W)?([0-9]+d)?/" />
</p:inputText>

I think primefaces extension uses the jquery keyfilter plugin. The regEx should be quoted around "//", but somehow the only possibility in my UI is to captial P



Solution 1:[1]

Try

regEx="/P([0-9]+Y)?([0-9]+M)?([0-9]+W)?([0-9]+d)?/"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marijn