Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

URGENT !!! need regular expression

Avatar

Level 3

Hi ,

I need a regular expression  for a text field

What if we left the 3 character limit on alphanumeric characters (a-z/A-Z) and remove the limit for numeric characters only (0-9)?

Thing is  if user enters alphanumeric values then there should be limit  of 3 characters for the text filed.

if user enter numeric values then there be no limit .

i think i have given a clear explanation regarding my question....

any replies are appreciated..

thanks

bharathi..

2 Replies

Avatar

Level 8

Try the following in the change event:

r=/^[a-z]{1,3}$|^\d+$/i;

if (!r.test(xfa.event.newText))

xfa.event.change="";

Kyle

Avatar

Level 3

Thank you so much
it is working....................