Link to home
Start Free TrialLog in
Avatar of developingprogrammer
developingprogrammer

asked on

regex to validate excel 2007 range input

hey guys,

i've got a regex question already! ha

i've got a custom input box. i want the user to enter a valid range address for excel 2007. so i've got this pattern ^[A-Za-z]{1,3}\d{1,7}$ which does a check if it is a valid excel 2007 range.

i do understand that my pattern is not completely correct - what if the user entered ZZZZ0, my pattern would pass but it's not a valid excel 2007 range address

what is the correct pattern i should use to limit the range to A1 to XFD1048576?

thanks guys!
SOLUTION
Avatar of QuinnDex
QuinnDex

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of developingprogrammer
developingprogrammer

ASKER

hi QuinnDex, thanks for posting Dennis' regex! = ) it work absolutely perfect!! really quite super brilliant.

hi aikimark! thanks for sharing your solution! it's really super insightful!

the reason why i marked aikimark's solution as the best solution is because it's a lot more readable and easy to understand - Dennis' regex works like magic but i can't really understand it (due to my lack of abilities no doubt!) and thus i think in terms of readability it's always better to have something we can understand and thus verify = )

thanks guys!! = ))