I am using mod_rewrite to rewrite some URL's for a database application. One of my URL's I am rewriting must start (after the base folder) with a folder named after one of the 50 U.S. states (ie. /alabama/, /alaska/, /arizona/, and so on.).
Is it okay to include all 50 of these state names within my RegEx pattern conditional? Or is that way too much info to put into a pattern and be too intensive?
Try it and see. I imagine it will work, but may take a while to run depending on how many strings you run it through, etc.
It also depends on what kind of regex engine you are using, DFA or NFA. From what I understand, you're doing it in PHP so that would be NFA - it will be a slower match, since it will attempt basically every combination possible for letters without remembering anything.
I think you for got Purto Rico and Guam... I think that might be a bit much too much. Can't you create an error checking function using php or some other scripting language? if state not in array permanant error... or something to that extent?