Forum Stats

  • 3,784,366 Users
  • 2,254,929 Discussions
  • 7,880,792 Comments

Discussions

RegExpression Not Working in <af:validateRegExp>

User_EP58N
User_EP58N Member Posts: 6 Blue Ribbon
edited Dec 1, 2021 12:03PM in JDeveloper and ADF

Hi,

I am using Jdeveloper 12.2.1.4.0 and my requirement is to have only numbers and characters in one input text attribute of .jsff page with no spaces and no special characters for which i have used the below pattern

 <af:column sortProperty="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.name}"

           filterable="true" sortable="true"

             headerText="Vehicle Registration No" id="c3">

        <af:inputText value="#{row.bindings.VehicleRegNo1.inputValue}" autoSubmit="true"

               label="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.label}"

               required="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.mandatory}"

               columns="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.displayWidth}"

               maximumLength="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.precision}"

               shortDesc="#{bindings.VehicleRegistrationUpdateLinesVO1.hints.VehicleRegNo1.tooltip}"

               id="it38">

         <f:validator binding="#{row.bindings.VehicleRegNo1.validator}"/>

         <af:validateRegExp pattern="^[A-Za-z0-9]$" messageDetailNoMatch="Registration Number must have only Numbers and characters"/>

        </af:inputText>

       </af:column>


Can someone help me with the correct pattern.

Tagged:

Best Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 37,807 Red Diamond
    Accepted Answer

    It would help if you could tell us what the problem is you see with your regular expression.

    From what I see your expression only allows one character or number. To allow multiple characters and numbers use

    [A-Za-z0-9]*
    

    the '*' means that the token before the '*' matches zero to unlimited times.


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,328 Gold Crown
    Accepted Answer

    Use reg expr ^[A-Za-z0-9]*$

Answers