Question
Regex Replacement Using a Drop-Down Menu (use image as refrence) The following list is what you'll use to create all the options for your select:
Regex Replacement Using a Drop-Down Menu (use image as refrence)
The following list is what you'll use to create all the options for your select:
AL Alabama
AK Alaska
AZ Arizona
AR Arkansas
CA California
CO Colorado
CT Connecticut
DE Delaware
FL Florida
GA Georgia
HI Hawaii
ID Idaho
IL Illinois
IN Indiana
IA Iowa
KS Kansas
KY Kentucky
LA Louisiana
ME Maine
MD Maryland
MA Massachusetts
MI Michigan
MN Minnesota
MS Mississippi
MO Missouri
MT Montana
NE Nebraska
NV Nevada
NH New Hampshire
NJ New Jersey
NM New Mexico
NY New York
NC North Carolina
ND North Dakota
OH Ohio
OK Oklahoma
OR Oregon
PA Pennsylvania
RI Rhode Island
SC South Carolina
SD South Dakota
TN Tennessee
TX Texas
UT Utah
VT Vermont
VA Virginia
WA Washington
WV West Virginia
WI Wisconsin
WY Wyoming
-----------------------
AB Alberta
BC British Columbia
MB Manitoba
NB New Brunswick
NL New Foundland
NS Nova Scotia
ON Ontario
PE Prince Edward Island
QC Quebec
SK Saskatchewan
1) Go to a scratch file
2) Paste in the list above
3) Ignore the SELECT and the group label USA.
4) The option tag needs a value for the server program: an ID that is unique and short... like the 2 letter abbreviation: "AL" for Alabama. We also need the text for people to read: such as the full name and abbreviation, as shown in the photo.
Example:
Alabama (AL)
5) Do a search and replace all which replaces each state listed into the HTML option we want to create. Two groups and back references will be required. Remember to use undo and find and replace 1 step at a time to make sure you've got it.
- Find 2 letter states 1st. find multiple times to make sure that works. group the 2 letters because you'll need them to replace later.
- Now find the state name as well. Using spaces is nice but Canada has a 3 word province. There are multiple ways to find the rest of the line. Once you get it matching each line when you find then you group the state/provice names with (). You'll now have 2 () you can reference. ..or maybe more () if you used them for your search.
- Replace. start just doing 1. and undoing it. make sure it works. the replace will be your HTML you used for Alabama. but replace the name with \1 and \2 (or $1 and $2.) Make sure it works. undo. then replace all. DONE! 60 in 1 move!
6) It is better to STRUCTURE the text for scanning by people looking for their state. Therefore, for better design, we want "AL Alabama" or "AL - Alabama" displayed to them so they can quickly scan down the list which will appear to have 2 columns due to the fact each state code is only 2 letters. Modify your replacement string and redo the search and replace again (you choose if you want a dash in there or not.
Choose Choose in USA Alabama (AL) Alaska (AK) Arizona (AZ) k. fo u Arkansas (AR) u Colorado (CO) rDelaware (DE) California (CA) Connecticut (CT) Florida (FL) Georgia (GA) Hawaii (HI) r Idaho (ID) Illinois (IL) Indiana (IN) lowa (IA) Kansas (KS) Kentucky (KY) Louisiana (LA)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started