KeyFilter KeyFilter can be used to filter keyboard input on specified input components.
Predefined masks and their regular expressions:
pint /[\d]/
int /[\d\-]/
pnum /[\d\.]/
money /[\d\.\s,]
num /[\d\-\.]/
hex /[0-9a-f]/i
email /[a-z0-9_\.\-@]/i
alpha /[a-z_]/i
alphanum /[a-z0-9_]/i


KeyFilter with regEx on a p:inputText
KeyFilter with mask on a h:inputText
KeyFilter with testFunction on a p:autoComplete
<h:form>
    <h:panelGrid columns="2">   
        <h:outputText value="KeyFilter with regEx on a p:inputText"/>   
        <p:inputText id="text1">
            <p:keyFilter regEx="/[ABC]/i"/>
        </p:inputText> 

        <h:outputText value="KeyFilter with mask on a h:inputText"/>   
        <h:inputText id="text2" />   

        <h:outputText value="KeyFilter with testFunction on a p:autoComplete" />  
        <p:autoComplete id="autoComplete1" value="#{autoCompleteView.txt1}" completeMethod="#{autoCompleteView.completeText}" />   
    </h:panelGrid> 

    <p:keyFilter for="text2" mask="num" /> 
    <p:keyFilter for="autoComplete1" testFunction="return c == 'z';" /> 
</h:form>
                
PrimeTek, Copyright © 2015
All rights reserved.
Running PrimeFaces-6.0.16 on Mojarra-2.2.8.