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:panelGrid columns="2">   
        <h:outputText value="KeyFilter with regEx on a p:inputText"/>   
        <p:inputText id="text1">
            <p:keyFilter regEx="/[ABC]/i"/>

        <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}" />   

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