Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
g

Test String

Code Generator

Generated Code

// include the latest version of the regex crate in your Cargo.toml extern crate regex; use regex::Regex; fn main() { let regex = Regex::new(r"(\[\d\])").unwrap(); let string = "United States From Wikipedia, the free encyclopedia (Redirected from Usa) For other uses, see US (disambiguation), USA (disambiguation), and United States (disambiguation). Page semi-protected United States of America Flag Great Seal Motto: \"In God we trust\" (official)[1][2][3] \"E pluribus unum\" (Latin) (traditional) \"Out of many, one\" Anthem: \"The Star-Spangled Banner\" Menu 0:00 Projection of North America with the United States in green Capital Washington, D.C. 38°53′N 77°01′W Largest city New York City Official languages None at federal level[a] National language English[b] Demonym American Government Federal presidential constitutional republic - President Barack Obama (D) - Vice President Joe Biden (D) - Speaker of the House John Boehner (R) - Chief Justice John Roberts Legislature Congress - Upper house Senate - Lower house House of Representatives Independence from Great Britain - Declared July 4, 1776 - Recognized September 3, 1783 - Constitution June 21, 1788 Area - Total 9,826,675 km2[4][c] (3rd/4th) 3,794,101 sq mi - Water (%) 6.76 Population - 2013 estimate 317,512,000[5] (3rd) - Density 34.2/km2 (179th) 88.6/sq mi GDP (PPP) 2013 estimate - Total $16.724 trillion[6] (1st) - Per capita $52,839[6] (6th) GDP (nominal) 2013 estimate - Total $16.724 trillion[6] (1st) - Per capita $52,839[6] (9th) Gini (2011) 47.7[7] high · 39th (2009) HDI (2013) Increase 0.937[8] very high · 3rd Currency United States dollar ($) (USD) Time zone (UTC−5 to −10) - Summer (DST) (UTC−4 to −10[e]) Drives on the right[g] Calling code +1 ISO 3166 code US Internet TLD .us .gov .mil .edu a. ^ English is the official language of at least 28 states; some sources give higher figures, based on differing definitions of \"official\".[9] English and Hawaiian are both official languages in the state of Hawaii. b. ^ English is the de facto language of American government and the sole language spoken at home by 80 percent of Americans aged five and older. Spanish is the second most commonly spoken language. c. ^ Whether the United States or China is larger has been disputed. The figure given is from the U.S. Central Intelligence Agency's The World Factbook. Other sources give smaller figures. All authoritative calculations of the country's size include only the 50 states and the District of Columbia, not the territories. d. ^ The population estimate is of people whose usual residence is within the 50 states and the District of Columbia, regardless of nationality. It does not include those living in the territories (over 4 million people, mostly in Puerto Rico). e. ^ See Time in the United States for details about laws governing time zones in the United States. f. ^ Does not include insular areas and United States Minor Outlying Islands, which have their own ISO 3166 codes. g. ^ Except U.S. Virgin Islands. The United States of America (USA), commonly referred to as the United States (US), America or simply the States, is a federal republic[10][11] consisting of 50 states and a federal district. The 48 contiguous states and the federal district of Washington, D.C., are in central North America between Canada and Mexico. The state of Alaska is the northwestern part of North America and the state of Hawaii is an archipelago in the mid-Pacific. The country also has five populated and nine unpopulated territories in the Pacific and the Caribbean. At 3.79 million square miles (9.83 million km2) in total and with around 317 million people, the United States is the fourth-largest country by total area and third largest by population. It is one of the world's most ethnically diverse and multicultural nations, the product of large-scale immigration from many countries.[12] The geography and climate of the United States is also extremely diverse, and it is home to a wide variety of wildlife. Paleo-indians migrated from Asia to what is now the U.S. mainland around 15,000 years ago,[13] with European colonization beginning in the 16th century. The United States emerged from 13 British colonies located along the Atlantic seaboard. Disputes between Great Britain and these colonies led to the American Revolution. On July 4, 1776, delegates from the 13 colonies unanimously issued the Declaration of Independence. The ensuing war ended in 1783 with the recognition of independence of the United States from the Kingdom of Great Britain, and was the first successful war of independence against a European colonial empire.[14][15] The current Constitution was adopted on September 17, 1787. The first 10 amendments, collectively named the Bill of Rights, were ratified in 1791 and guarantee many fundamental civil rights and freedoms. Driven by the doctrine of manifest destiny, the United States embarked on a vigorous expansion across North America throughout the 19th century.[16] This involved displacing native tribes, acquiring new territories, and gradually admitting new states.[16] The American Civil War ended legal slavery in the country.[17] By the end of the 19th century, the United States extended into the Pacific Ocean,[18] and its economy was the world's largest.[19] The Spanish–American War and World War I confirmed the country's status as a global military power. The United States emerged from World War II as a global superpower, the first country with nuclear weapons, and a permanent member of the United Nations Security Council. The end of the Cold War and the dissolution of the Soviet Union left the United States as the sole superpower. The United States is a developed country and has the world's largest national economy, with an estimated GDP in 2013 of $16.7 trillion – 23% of global nominal GDP and 19% at purchasing-power parity.[6][20] The economy is fueled by an abundance of natural resources and the world's highest worker productivity,[21] with per capita GDP being the world's sixth-highest in 2010.[6] While the U.S. economy is considered post-industrial, it continues to be one of the world's largest manufacturers.[22] The U.S. has the highest mean and second-highest median household income in the OECD as well as the highest average wage,[23][24] though it has the fourth most unequal income distribution among OECD nations[25][26] with roughly 16% of the population living in poverty.[27] The country accounts for 39% of global military spending,[28] being the world's foremost economic and military power, a prominent political and cultural force, and a leader in scientific research and technological innovation.[29][30] Contents 1 Etymology 2 History 2.1 Native American and European contact 2.2 Settlements 2.3 Independence and expansion 2.4 Civil War and Reconstruction Era 2.5 Industrialization 2.6 World War I, Great Depression, and World War II 2.7 Cold War and Civil Rights era 2.8 Contemporary era 3 Geography, climate, and environment 3.1 Environmental issues 4 Demographics 4.1 Population 4.2 Language 4.3 Religion 4.4 Family structure 5 Government and politics 5.1 Political divisions 5.2 Parties and elections 5.3 Foreign relations 5.4 Government finance 5.4.1 Public debt 6 Military 7 Crime and law enforcement 8 Economy 8.1 Income, poverty, and wealth 9 Infrastructure 9.1 Transportation 9.2 Energy 10 Science and technology 11 Education 12 Health 13 Culture 13.1 Popular media 13.2 Literature, philosophy, and the arts 13.3 Food 13.4 Sports 14 See also 15 References 16 Bibliography 16.1 Website sources 17 External links Etymology See also: Names for United States citizens In 1507, the German cartographer Martin Waldseemüller produced a world map on which he named the lands of the Western Hemisphere \"America\" after the Italian explorer and cartographer Amerigo Vespucci (Latin: Americus Vespucius).[31] The first documentary evidence of the phrase \"United States of America\" is from a letter dated January 2, 1776, written by Stephen Moylan, Esq., George Washington's aide-de-camp and Muster-Master General of the Continental Army. Addressed to Lt. Col. Joseph Reed, Moylan expressed his wish to carry the \"full and ample powers of the United States of America\" to Spain to assist in the revolutionary war effort.[32] The first publicly published evidence of the phrase \"United States of America\" was in an anonymously written essay in The Virginia Gazette newspaper in Williamsburg, Virginia, on April 6, 1776.[33][34] In June 1776, Thomas Jefferson included the phrase \"UNITED STATES OF AMERICA\" in all capitalized letters in the headline of his \"original Rough draught\" of the Declaration of Independence.[35][36] In the final Fourth of July version of the Declaration, the pertinent section of the title was changed to read, \"The unanimous Declaration of the thirteen united States of America\".[37] In 1777 the Articles of Confederation announced, \"The Stile of this Confederacy shall be 'The United States of America'\".[38] The short form \"United States\" is also standard. Other common forms include the \"U.S.\", the \"USA\", and \"America\". Colloquial names include the \"U.S. of A.\" and, internationally, the \"States\". \"Columbia\", a name popular in poetry and songs of the late 1700s,[39] derives its origin from Christopher Columbus; it appears in the name \"District of Columbia\". In non-English languages, the name is frequently translated as the translation of either the \"United States\" or \"United States of America\", and colloquially as \"America\". In addition, an acronym is sometimes used.[40] The phrase \"United States\" was originally treated as plural, a description of a collection of independent states—e.g., \"the United States are\"—including in the Thirteenth Amendment to the United States Constitution, ratified in 1865. It became common to treat it as singular, a single unit—e.g., \"the United States is\"—after the end of the Civil War. The singular form is now standard; the plural form is retained in the idiom \"these United States\".[41] The difference has been described as more significant than one of usage, but reflecting the difference between a collection of states and a unit.[42] The standard way to refer to a citizen of the United States is as an \"American\". \"United States\", \"American\" and \"U.S.\" are used to refer to the country adjectivally (\"American values\", \"U.S. forces\"). \"American\" is rarely used in English to refer to subjects not connected with the United States.[43] History Main articles: History of the United States and Timeline of United States history Native American and European contact Meeting of Native Americans and Europeans, 1764 People from Asia migrated to the North American continent approximately 15,000 or more years ago.[13][44] Some, such as the pre-Columbian Mississippian culture, developed advanced agriculture, grand architecture, and state-level societies. After European explorers and traders made the first contacts, it is estimated that their population declined due to various reasons, including diseases such as smallpox and measles,[45][46] intermarriage,[47] and violence.[48][49][50] In the early days of colonization many settlers were subject to shortages of food, disease and attacks from Native Americans. Native Americans were also often at war with neighboring tribes and allied with Europeans in their colonial wars.[51] At the same time however many natives and settlers came to depend on each other. Settlers traded for food and animal pelts, natives for guns, ammunition and other European wares.[52] Natives taught many settlers where, when and how to cultivate corn, beans and squash in the frontier. European missionaries and others felt it was important to \"civilize\" the Indians and urged them to concentrate on farming and ranching without depending on hunting and gathering.[53][54] Settlements Further information: European colonization of the Americas and 13 colonies The signing of the Mayflower Compact, 1620 After Columbus' first voyage to the New World in 1492 other explorers and settlement followed into the Floridas and the American Southwest.[55][56] There were also some French attempts to colonize the east coast, and later more successful settlements along the Mississippi River. Successful English settlement on the eastern coast of North America began with the Virginia Colony in 1607 at Jamestown and the Pilgrims' Plymouth Colony in 1620. Early experiments in communal living failed until the introduction of private farm holdings.[57] The continent's first elected legislative assembly, Virginia's House of Burgesses created in 1619, and the Mayflower Compact, signed by the Pilgrims before disembarking, established precedents for the pattern of representative self-government and constitutionalism that would develop throughout the American colonies.[58][59] Most settlers in every colony were small farmers, but other industries developed. Cash crops included tobacco, rice and wheat. Extraction industries grew up in furs, fishing and lumber. Manufacturers produced rum and ships and by the late colonial period Americans were producing one-seventh of the world's iron supply.[60] Cities eventually dotted the coast to support local economies and serve as trade hubs. English colonists were supplemented by waves of Scotch-Irish and other groups. As coastal land grew more expensive freed indentured servants pushed further west.[61] Slave cultivation of cash crops began with the Spanish in the 1500s, and was adopted by the English, but life expectancy was much higher in North America because of less disease and better food and treatment, so the numbers of slaves grew rapidly.[62][63][64] Colonial society was largely divided over the religious and moral implications of slavery and colonies passed acts for and against the practice.[65][66] But by the turn of the 18th century, African slaves were replacing indentured servants for cash crop labor, especially in southern regions.[67] With the 1732 colonization of Georgia, the 13 colonies that would become the United States of America were established.[68] All had local governments with elections open to most free men, with a growing devotion to the ancient rights of Englishmen and a sense of self-government stimulating support for republicanism.[69] With extremely high birth rates, low death rates, and steady settlement, the colonial population grew rapidly. Relatively small Native American populations were eclipsed.[70] The Christian revivalist movement of the 1730s and 1740s known as the Great Awakening fueled interest in both religion and religious liberty. In the French and Indian War, British forces seized Canada from the French, but the francophone population remained politically isolated from the southern colonies. Excluding the Native Americans, who were being conquered and displaced, those 13 colonies had a population of over 2.1 million in 1770, about one-third that of Britain. Despite continuing new arrivals, the rate of natural increase was such that by the 1770s only a small minority of Americans had been born overseas.[71] The colonies' distance from Britain had allowed the development of self-government, but their success motivated monarchs to periodically seek to reassert Royal authority. Independence and expansion The Declaration of Independence: the Committee of Five presenting their draft to the Second Continental Congress in 1776. Further information: American Revolutionary War, Declaration of Independence, and American Revolution The American Revolution was the first successful colonial war of independence against a European power. Americans had developed an ideology of \"republicanism\" that held government rested on the will of the people as expressed in their local legislatures. They demanded their rights as Englishmen, “no taxation without representation”. The British insisted on administering the empire through Parliament, and the conflict escalated into the American Revolutionary War.[72] The Congress adopted the Declaration of Independence, on July 4, 1776, proclaiming that humanity is created equal in their inalienable rights. That date is now celebrated annually as America's Independence Day. In 1777, the Articles of Confederation established a weak government that operated until 1789.[73] Britain recognized the independence of the United States following their defeat at Yorktown.[74] In the peace treaty of 1783, American sovereignty was recognized from the Atlantic coast west to the Mississippi River. Nationalists led the Philadelphia Convention of 1787 in writing the United States Constitution, and it was ratified in state conventions in 1788. The federal government was reorganized into three branches for their checks and balances in 1789. The Bill of Rights, forbidding federal restriction of personal freedoms and guaranteeing a range of legal protections, was adopted in 1791.[75] Although the federal government criminalized the international slave trade in 1808, after 1820 cultivation of the highly profitable cotton crop exploded in the Deep South, and along with it the slave population.[76][77][78] The Second Great Awakening, beginning about 1800, converted millions to evangelical Protestantism. In the North it energized multiple social reform movements, including abolitionism,[79] in the South, Methodists and Baptists proselytized among slave populations.[80] U.S. territorial acquisitions–portions of each territory were granted statehood over time Americans' eagerness to expand westward prompted a long series of Indian Wars.[81] The Louisiana Purchase of French-claimed territory in 1803 almost doubled the nation's size.[82] The War of 1812, declared against Britain over various grievances and fought to a draw, strengthened U.S. nationalism.[83] A series of U.S. military incursions into Florida led Spain to cede it and other Gulf Coast territory in 1819.[84] Expansion was aided by steam power, when steamboats began traveling along America's large water systems, which were connected by new canals, such as the Erie and the I&M; then, even faster railroads began their streach across the nation's land.[85] From 1820 to 1850, Jacksonian democracy began a set of reforms which included wider male suffrage, and it led to the rise of the Second Party System of Democrats and Whigs as the dominant parties from 1828 to 1854. The Trail of Tears in the 1830s exemplified the Indian removal policy that moved Indians into the west to their own reservations. The U.S. annexed the Republic of Texas in 1845 during a period of expansionist Manifest Destiny.[86] The 1846 Oregon Treaty with Britain led to U.S. control of the present-day American Northwest.[87] Victory in the Mexican-American War resulted in the 1848 Mexican Cession of California and much of the present-day American Southwest.[88] The California Gold Rush of 1848–49 spurred western migration and the creation of additional western states.[89] After the American Civil War, new transcontinental railways made relocation easier for settlers, expanded internal trade and increased conflicts with Native Americans.[90] Over a half-century, the loss of the buffalo was an existential blow to many Plains Indians cultures.[91] In 1869, a new Peace Policy sought to protect Native-Americans from abuses, avoid further warfare, and secure their eventual U.S. citizenship.[92] Civil War and Reconstruction Era Further information: American Civil War and Reconstruction Era Battle of Gettysburg, Pennsylvania. The Civil War cemented the Union and spurred the steel industry and transcontinental railroad construction. From the beginning of the United States, inherent divisions over slavery between the North and the South in American society ultimately led to the American Civil War.[93] Initially states entering the Union alternated slave and free, keeping a sectional balance in the Senate, while free states outstripped slave states in population and in the House of Representatives. But with additional western territory and more free-soil states, tensions between slave and free states mounted with arguments over federalism and disposition of the territories, whether and how to expand or restrict slavery.[94] Beginning in December 1860, conventions in thirteen states declared secession, then formed the Confederate States of America, and the U.S. federal government maintained secession was illegal.[94] The ensuing war was at first for Union, then after 1863 as casualties mounted and the Emancipation Proclamation, a second war aim became abolition of slavery. The war remains the deadliest military conflict in American history, resulting in the deaths of approximately 620,000 soldiers as well as many civilians.[95] Following the Union victory in 1865, three amendments to the U.S. Constitution prohibited slavery, made the nearly four million African Americans who had been slaves[96] U.S. citizens, and promised them voting rights. The war and its resolution led to a substantial increase in federal power[97] aimed at reintegrating and rebuilding the Southern states while ensuring the rights of the newly freed slaves.[98] But following the Reconstruction Era, throughout the South Jim Crow laws soon effectively disenfranchised most blacks and some poor whites. Over the subsequent decades, in both the north and south blacks and some whites faced systemic discrimination, including racial segregation and occasional vigilante violence, sparking national movements against these abuses.[98] Industrialization Further information: Labor history of the United States Ellis Island, New York City. East Coast immigrants worked in factories, railroads, and mines, and created demand for industrialized agriculture. In the North, urbanization and an unprecedented influx of immigrants from Southern and Eastern Europe hastened the country's industrialization. The wave of immigration, lasting until 1924, provided labor and transformed American culture.[99] United States immigration policies were Eurocentric, which barred Asians from naturalization, and restricted their immigration beginning with the Chinese Exclusion Act in 1882.[100] National infrastructure development spurred economic growth. The end of the Civil War spurred greater settlement and development of the American Old West. This was due to a variety of social and technological developments, including the completion of the First Transcontinental Telegraph in 1861 and the First Transcontinental Railroad in 1869. Later in the era, inventions in electric light and the telephone changed urban life and communication.[101] During the early 20th century, mass production of such inventions as the automobile and then aircraft altered American industry, labor, and transportation. The 1867 Alaska Purchase from Russia completed the country's mainland expansion. The Wounded Knee Massacre in 1890 was the last major armed conflict of the Indian Wars. In 1893, the indigenous monarchy of the Pacific Kingdom of Hawaii was overthrown in a coup led by American residents; the United States annexed the archipelago in 1898. Victory in the Spanish–American War the same year demonstrated that the United States was a world power and led to the annexation of Puerto Rico, Guam, and the Philippines.[102] The Philippines gained independence a half-century later; Puerto Rico and Guam remain U.S. territories. The emergence of many prominent industrialists at the end of the 19th century gave rise to the Gilded Age, a period of growing affluence and power among the business class. The hardships the working classes experienced during this period led to the rise of anarchist and socialist movements in the U.S.[103] In 1914 alone, 35,000 workers died in industrial accidents and 700,000 were injured.[104] This period eventually ended with the beginning of the Progressive Era, a period of significant reforms in many societal areas, including regulatory protection for the public, greater antitrust measures, and attention to living conditions for the working classes. President Theodore Roosevelt was one leading proponent of progressive reforms. World War I, Great Depression, and World War II Further information: World War I, Great Depression, and World War II The Dust Bowl brought agricultural depression, impacted industrial markets, and led to large relocation out of the Great Plains. At the outbreak of World War I in 1914, the United States remained neutral. Most Americans sympathized with the British and French, although many opposed intervention.[105] In 1917, the United States joined the Allies, and the American Expeditionary Forces helped to turn the tide against the Central Powers. President Woodrow Wilson took a leading diplomatic role at the Paris Peace Conference of 1919 which helped to shape the post-war world. Wilson advocated strongly for the U.S. to join the League of Nations. However, the Senate refused to approve this, and did not ratify the Treaty of Versailles, which established the League of Nations.[106] The country pursued a policy of unilateralism, verging on isolationism.[106] In 1920, the women's rights movement, led by Carrie Chapman Catt, won passage of a constitutional amendment granting women's suffrage.[107] The 1920s and 1930s saw the rise of radio for mass communication and the invention of early television.[108] The prosperity of the Roaring Twenties ended with the Wall Street Crash of 1929 that triggered the Great Depression. After his election as president in 1932, Franklin D. Roosevelt responded with the New Deal, a range of policies increasing government intervention in the economy, including the establishment of the Social Security system.[109] The Dust Bowl of the mid-1930s impoverished many farming communities and spurred a new wave of western migration. The United States, effectively neutral during World War II's early stages after Nazi Germany's invasion of Poland in September 1939, began supplying material to the Allies in March 1941 through the Lend-Lease program. On December 7, 1941, the Empire of Japan launched a surprise attack on Pearl Harbor, prompting the United States to join the Allies against the Axis powers as well as the internment of Japanese Americans by the thousands.[110] Participation in the war spurred capital investment and industrial capacity.[111] Though the nation lost more than 400,000 soldiers,[112] the war was a major economic benefit for the country.[113] Allied conferences at Bretton Woods and Yalta outlined a new system of international organizations that placed the United States and Soviet Union at the center of world affairs. As victory was won in Europe, a 1945 international conference held in San Francisco produced the United Nations Charter, which became active after the war.[114] The United States, having developed the first nuclear weapons, used them on the Japanese cities of Hiroshima and Nagasaki in August. Japan surrendered on September 2, ending the war.[115] Cold War and Civil Rights era Civil Rights leaders, including Ralph Abernathy and Martin Luther King, Jr., lead one of the Selma to Montgomery marches. US President Ronald Reagan (left) and Soviet General Secretary Mikhail Gorbachev, meeting in Geneva in 1985. The United States and the Soviet Union jockeyed for power after World War II during the Cold War, dominating the military affairs of Europe through NATO and the Warsaw Pact, respectively. While they engaged in proxy wars and developed powerful nuclear arsenals, the two countries avoided direct military conflict. The U.S. often opposed Third World left-wing movements that it viewed as Soviet-sponsored. American troops fought Communist Chinese and North Korean forces in the Korean War of 1950–53. The House Un-American Activities Committee pursued a series of investigations into suspected leftist subversion, while Senator Joseph McCarthy became the figurehead of anticommunist sentiment.[116] In the 1950s, Dwight D. Eisenhower championed the construction of the largest and most expensive public works project in American history, the Interstate Highway System.[117][118] The 1961 Soviet launch of the first manned spaceflight prompting President John F. Kennedy's call for the United States to be first to land \"a man on the moon\" was achieved in 1969 via the Apollo program.[119] A different government initiative, ARPA pioneered the development of ARPANET and TCP/IP, the basis for the internet.[120] Kennedy also faced a tense nuclear showdown with Soviet forces in Cuba.[121] Meanwhile, the United States experienced sustained economic expansion. Amidst the presence of various white supremacist groups, particularly the Ku Klux Klan, a growing civil rights movement used nonviolence to confront segregation and discrimination. This was symbolized and led by black Americans such as Rosa Parks and Martin Luther King, Jr. On the other hand, some black nationalist groups such as the Black Panther Party and Malcolm X had a more militant scope. Following Kennedy's assassination in 1963, the Civil Rights Act of 1964, Voting Rights Act of 1965, and Immigration and Nationality Act of 1965 were passed under President Lyndon B. Johnson.[122][123][124] He also signed into law the Medicare and Medicaid programs.[125] Johnson also expanded a proxy war in Southeast Asia into the ultimately unsuccessful Vietnam War. A widespread countercultural movement grew, fueled by opposition to the war, black nationalism, and the sexual revolution. Betty Friedan, Gloria Steinem, and others led a new wave of feminism that sought political, social, and economic equality for women. In the 1970s, the American economy was hurt by two major energy shocks. The Nixon Administration restored normal relations with China and oversaw the beginning of a period of generally eased relations with the Soviet Union. As a result of the Watergate scandal, in 1974 Nixon became the first U.S. president to resign, to avoid being impeached on charges including obstruction of justice and abuse of power. The Carter Administration of the late 1970s was marked by the Iran hostage crisis, stagflation, and an increase of tensions with the Soviet Union following the Soviet intervention in Afghanistan. The election of Ronald Reagan as president in 1980 heralded a rightward shift in American politics,[126][127][128][129] reflected in major changes in taxation and spending priorities.[130][131][132] His second term in office brought both the Iran–Contra scandal and significant diplomatic progress with the Soviet Union.[133][134][135][136] The subsequent Soviet collapse ended the Cold War.[137][138][139][140][141] Contemporary era September 11, 2001 attacks on the World Trade Center in New York City. Under President George H. W. Bush, the United States took a lead role in the UN–sanctioned Gulf War.[142] The longest economic expansion in modern U.S. history—from March 1991 to March 2001—encompassed the Bill Clinton administration and the dot-com bubble.[143] On September 11, 2001, al-Qaeda terrorists under the leadership of Osama bin Laden struck the World Trade Center in New York City and The Pentagon near Washington, D.C., killing nearly 3,000 people.[144] In response, the George W. Bush administration launched the global War on Terror, invading Afghanistan and removing the Taliban government and al-Qaeda training camps.[145] However, Taliban insurgents were never completely defeated and continue to fight a guerrilla war against U.S. forces.[146] In 2003, the United States and several allied forces launched an invasion of Iraq to engineer regime change there, beginning the Iraq War. American combat troops fought in the country for eight years.[147][148][149] In 2008, amid a global economic recession and two wars, the first African-American president, Barack Obama, was elected.[150] On May 2, 2011, Osama bin Laden was killed during an American Navy SEAL raid on his compound in Abbottabad, Pakistan.[151] Geography, climate, and environment Main articles: Geography of the United States, Climate of the United States, and Environment of the United States A composite satellite image of the contiguous United States The land area of the contiguous United States is 2,959,064 square miles (7,663,941 km2). Alaska, separated from the contiguous United States by Canada, is the largest state at 663,268 square miles (1,717,856 km2). Hawaii, occupying an archipelago in the central Pacific, southwest of North America, is 10,931 square miles (28,311 km2) in area.[152] The United States is the world's third or fourth largest nation by total area (land and water), ranking behind Russia and Canada and just above or below China. The ranking varies depending on how two territories disputed by China and India are counted and how the total size of the United States is measured: calculations range from 3,676,486 square miles (9,522,055 km2)[153] to 3,717,813 square miles (9,629,091 km2)[154] to 3,794,101 square miles (9,826,676 km2).[4] Measured by only land area, the United States is third in size behind Russia and China, just ahead of Canada.[155] The coastal plain of the Atlantic seaboard gives way further inland to deciduous forests and the rolling hills of the Piedmont. The Appalachian Mountains divide the eastern seaboard from the Great Lakes and the grasslands of the Midwest. The Mississippi–Missouri River, the world's fourth longest river system, runs mainly north–south through the heart of the country. The flat, fertile prairie of the Great Plains stretches to the west, interrupted by a highland region in the southeast. A Bald Eagle, the national bird of the United States since 1782. The Rocky Mountains, at the western edge of the Great Plains, extend north to south across the country, reaching altitudes higher than 14,000 feet (4,300 m) in Colorado. Farther west are the rocky Great Basin and deserts such as the Chihuahua and Mojave. The Sierra Nevada and Cascade mountain ranges run close to the Pacific coast, both ranges reaching altitudes higher than 14,000 feet (4,300 m). The lowest and highest points in the continental United States are in the state of California, and only about 80 miles (130 km) apart. At 20,320 feet (6,194 m), Alaska's Mount McKinley is the tallest peak in the country and in North America. Active volcanoes are common throughout Alaska's Alexander and Aleutian Islands, and Hawaii consists of volcanic islands. The supervolcano underlying Yellowstone National Park in the Rockies is the continent's largest volcanic feature.[156] The United States, with its large size and geographic variety, includes most climate types. To the east of the 100th meridian, the climate ranges from humid continental in the north to humid subtropical in the south. The southern tip of Florida is tropical, as is Hawaii. The Great Plains west of the 100th meridian are semi-arid. Much of the Western mountains are alpine. The climate is arid in the Great Basin, desert in the Southwest, Mediterranean in coastal California, and oceanic in coastal Oregon and Washington and southern Alaska. Most of Alaska is subarctic or polar. Extreme weather is not uncommon—the states bordering the Gulf of Mexico are prone to hurricanes, and most of the world's tornadoes occur within the country, mainly in the Midwest's Tornado Alley.[157] The U.S. ecology is considered \"megadiverse\": about 17,000 species of vascular plants occur in the contiguous United States and Alaska, and over 1,800 species of flowering plants are found in Hawaii, few of which occur on the mainland.[158] The United States is home to more than 400 mammal, 750 bird, and 500 reptile and amphibian species.[159] About 91,000 insect species have been described.[160] There are 58 national parks and hundreds of other federally managed parks, forests, and wilderness areas.[161] Altogether, the government owns 28.8% of the country's land area.[162][dead link] Most of this is protected, though some is leased for oil and gas drilling, mining, logging, or cattle ranching; 2.4% is used for military purposes.[162][dead link][163][164] Environmental issues Main articles: Environmental issues in the United States and Conservation movement#United States Environmental issues have been on the national agenda since 1970. Environmental controversies include debates on oil and nuclear energy, dealing with air and water pollution, the economic costs of protecting wildlife, logging and deforestation,[165][166] and international responses to global warming.[167][168] Many federal and state agencies are involved. The most prominent is the Environmental Protection Agency (EPA), created by presidential order in 1970.[169] The idea of wilderness has shaped the management of public lands since 1964, with the Wilderness Act.[170] The Endangered Species Act of 1973 is intended to protect threatened and endangered species and their habitats, which are monitored by the United States Fish and Wildlife Service. Demographics Main articles: Demographics of the United States, Americans, and List of United States cities by population Population Largest ancestry groups by county, 2000 Race/Ethnicity (as given by the 2010 Census)[171] By race: White 72.4% African American 12.6% Asian 4.8% American Indian and Alaska Native 0.9% Native Hawaiian and Pacific Islander 0.2% Other 6.2% Multiracial (2 or more) 2.9% By ethnicity:[172] Hispanic/Latino (of any race) 16.3% Non-Hispanic/Latino (of any race) 83.7% The U.S. Census Bureau estimates the country's population now to be 317,512,000,[5] including an approximate 11.2 million illegal immigrants.[173] The U.S. population almost quadrupled during the 20th century, from about 76 million in 1900.[174] The third most populous nation in the world, after China and India, the United States is the only major industrialized nation in which large population increases are projected.[175] With a birth rate of 13 per 1,000, 35% below the world average, its population growth rate is positive at 0.9%, significantly higher than those of many developed nations.[176] In fiscal year 2012, over one million immigrants (most of whom entered through family reunification) were granted legal residence.[177] Mexico has been the leading source of new residents since the 1965 Immigration Act. China, India, and the Philippines have been in the top four sending countries every year.[178][179] Nine million Americans identify as homosexual, bisexual or transgender, making up less than four percent of the population.[180] A 2010 survey found that seven percent of men and eight percent of women identified as gay, lesbian or bisexual.[181] The United States has a very diverse population—31 ancestry groups have more than one million members.[182] White Americans are the largest racial group; German Americans, Irish Americans, and English Americans constitute three of the country's four largest ancestry groups.[182] Black Americans are the nation's largest racial minority and third largest ancestry group.[182] Asian Americans are the country's second largest racial minority; the three largest Asian American ethnic groups are Chinese Americans, Filipino Americans, and Indian Americans.[182] In 2010, the U.S. population included an estimated 5.2 million people with some American Indian or Alaska Native ancestry (2.9 million exclusively of such ancestry) and 1.2 million with some native Hawaiian or Pacific island ancestry (0.5 million exclusively).[183] The census counted more than 19 million people of \"Some Other Race\" who were \"unable to identify with any\" of its five official race categories in 2010.[183] The population growth of Hispanic and Latino Americans (the terms are officially interchangeable) is a major demographic trend. The 50.5 million Americans of Hispanic descent[183] are identified as sharing a distinct \"ethnicity\" by the Census Bureau; 64% of Hispanic Americans are of Mexican descent.[184] Between 2000 and 2010, the country's Hispanic population increased 43% while the non-Hispanic population rose just 4.9%.[171] Much of this growth is from immigration; in 2007, 12.6% of the U.S. population was foreign-born, with 54% of that figure born in Latin America.[185] Fertility is also a factor; in 2010 the average Hispanic (of any race) woman gave birth to 2.35 children in her lifetime, compared to 1.97 for non-Hispanic black women and 1.79 for non-Hispanic white women (both below the replacement rate of 2.1).[186] Minorities (as defined by the Census Bureau as all those beside non-Hispanic, non-multiracial whites) constituted 36.3% of the population in 2010,[187] and over 50% of children under age one,[188] and are projected to constitute the majority by 2042.[189] This contradicts the report by the National Vital Statistics Reports, based on the U.S. census data, which concludes that, 54% (2,162,406 out of 3,999,386 in 2010) of births were non-Hispanic white.[186] About 82% of Americans live in urban areas (including suburbs);[4] about half of those reside in cities with populations over 50,000.[190] In 2008, 273 incorporated places had populations over 100,000, nine cities had more than one million residents, and four global cities had over two million (New York City, Los Angeles, Chicago, and Houston).[191] There are 52 metropolitan areas with populations greater than one million.[192] Of the 50 fastest-growing metro areas, 47 are in the West or South.[193] The metro areas of Dallas, Houston, Atlanta, and Phoenix all grew by more than a million people between 2000 and 2008.[192] Leading population centers (see complete list) view talk edit Rank Core city (cities) Metro area population Metropolitan Statistical Area Region[194] New York City New York City Los Angeles Los Angeles Chicago Chicago 1 New York City 19,015,900 New York-Newark-Jersey City, NY-NJ-PA MSA Northeast 2 Los Angeles 12,944,801 Los Angeles–Long Beach–Santa Ana, CA MSA West 3 Chicago 9,504,753 Chicago–Joliet–Naperville, IL–IN–WI MSA Midwest 4 Dallas–Fort Worth 6,526,548 Dallas–Fort Worth–Arlington, TX MSA South 5 Houston 6,086,538 Houston–The Woodlands-Sugar Land MSA South 6 Philadelphia 5,992,414 Philadelphia–Camden–Wilmington, PA–NJ–DE–MD MSA Northeast 7 Washington, D.C. 5,703,948 Washington, DC–VA–MD–WV MSA Northeast 8 Miami 5,670,125 Miami–Fort Lauderdale–Pompano Beach, FL MSA South 9 Atlanta 5,359,205 Atlanta–Sandy Springs–Marietta, GA MSA South 10 Boston 4,591,112 Boston–Cambridge–Quincy, MA–NH MSA Northeast 11 San Francisco 4,391,037 San Francisco–Oakland–Fremont, CA MSA West 12 San Bernardino-Riverside 4,304,997 San Bernandino–Riverside–Ontario, CA MSA West 13 Detroit 4,285,832 Detroit–Warren–Livonia, MI MSA Midwest 14 Phoenix 4,263,236 Phoenix–Mesa–Glendale, AZ MSA West 15 Seattle 3,500,026 Seattle–Tacoma–Bellevue, WA MSA West 16 Minneapolis–St. Paul 3,318,486 Minneapolis–St. Paul–Bloomington, MN–WI MSA Midwest 17 San Diego 3,140,069 San Diego–Carlsbad–San Marcos, CA MSA West 18 Tampa–St. Petersburg 2,824,724 Tampa–St. Petersburg–Clearwater, FL MSA South 19 St. Louis 2,817,355 St. Louis–St. Charles–Farmington, MO–IL MSA Midwest 20 Baltimore 2,729,110 Baltimore–Towson, MD MSA Northeast based upon 2011 population estimates from the U.S. Census Bureau[195] Language Main article: Languages of the United States See also: Language Spoken at Home and List of endangered languages in the United States Languages spoken by more than 1,000,000 in the U.S. as of 2010[196] Language Percentage of population Number of speakers English 80% 233,780,338 Combined total of all languages other than English 20% 57,048,617 Spanish (excluding Puerto Rico and Spanish Creole) 12% 35,437,985 Chinese (including Cantonese and Mandarin) 0.9% 2,567,779 Tagalog 0.5% 1,542,118 Vietnamese 0.4% 1,292,448 French 0.4% 1,288,833 Korean 0.4% 1,108,408 German 0.4% 1,107,869 English (American English) is the de facto national language. Although there is no official language at the federal level, some laws—such as U.S. naturalization requirements—standardize English. In 2010, about 230 million, or 80% of the population aged five years and older, spoke only English at home. Spanish, spoken by 12% of the population at home, is the second most common language and the most widely taught second language.[197][198] Some Americans advocate making English the country's official language, as it is in at least 28 states.[9] Both Hawaiian and English are official languages in Hawaii, by state law.[199] While neither has an official language, New Mexico has laws providing for the use of both English and Spanish, as Louisiana does for English and French.[200] Other states, such as California, mandate the publication of Spanish versions of certain government documents including court forms.[201] Many jurisdictions with large numbers of non-English speakers produce government materials, especially voting information, in the most commonly spoken languages in those jurisdictions. Several insular territories grant official recognition to their native languages, along with English: Samoan and Chamorro are recognized by American Samoa and Guam, respectively; Carolinian and Chamorro are recognized by the Northern Mariana Islands; Spanish is an official language of Puerto Rico and is more widely spoken than English there.[202] Religion Main article: Religion in the United States See also: History of religion in the United States, Freedom of religion in the United States, Separation of church and state in the United States, and List of religious movements that began in the United States Religious affiliation in the U.S. (2012)[203] Affiliation % of U.S. population Christian 73 Protestant 48 Evangelical Protestant 19 Mainline Protestant 15 Black church 8 Catholic 22 Mormon 2 Eastern Orthodox 1 Other Faith 6 Unaffiliated 19.6 Nothing in particular 13.9 Agnostic 3.3 Atheist 2.4 Don't know/refused answer 2 Total 100 The First Amendment of the U.S. Constitution guarantees the free exercise of religion and forbids Congress from passing laws respecting its establishment. Christianity is by far the most common religion practiced in the U.S., but other religions are followed, too. In a 2013 survey, 56% of Americans said that religion played a \"very important role in their lives\", a far higher figure than that of any other wealthy nation.[204] In a 2009 Gallup poll 42% of Americans said that they attended church weekly or almost weekly; the figures ranged from a low of 23% in Vermont to a high of 63% in Mississippi.[205] According to a 2012 survey, 73% of adults identified themselves as Christian,[206] down from 86.4% in 1990.[207] Protestant denominations accounted for 48%, while Roman Catholicism, at 22%, was the largest individual denomination.[206] The total reporting non-Christian religions in 2012 was 6%, up from 4% in 2007.[206] Other religions include Judaism (1.7%), Buddhism (0.7%), Islam (0.6%), Hinduism (0.4%), and Unitarian Universalism (0.3%).[206] The survey also reported that 19.6% of Americans described themselves as agnostic, atheist, or simply having no religion, up from 8.2% in 1990.[206][207][208] There are also Baha'i, Sikh, Jain, Shinto, Confucian, Taoist, Druid, Native American, Wiccan, humanist and deist communities.[209] Protestantism is the largest group of religions in the United States, with Baptists being the largest Protestant sect, and the Southern Baptist Convention being the largest Protestant denomination in the U.S. Roman Catholicism in the U.S. has its origin in the Spanish and French colonization of the Americas, and later grew due to Irish, Italian, Polish, German and Hispanic immigration. Rhode Island is the only state where the majority of the population is Catholic. Lutheranism in the U.S. has its origin in immigration from Northern Europe. North and South Dakota are the only states in which a plurality of the population is Lutheran. Utah is the only state where Mormonism is the religion of the majority of the population. Mormonism is also relatively common in parts of Idaho, Nevada and Wyoming. The Bible Belt is an informal term for a region in the Southern United States in which socially conservative evangelical Protestantism is a significant part of the culture and Christian church attendance across the denominations is generally higher than the nation's average. By contrast, religion plays the least important role in New England and in the Western United States.[205] As with other Western countries, the U.S. is becoming less religious. Irreligion is growing rapidly among Americans under 30.[210] Polls show that overall American confidence in organized religion is declining,[211] and that younger Americans in particular are becoming increasingly irreligious.[212] Family structure Main article: Family structure in the United States In 2007, 58% of Americans age 18 and over were married, 6% were widowed, 10% were divorced, and 25% had never been married.[213] Women now work mostly outside the home and receive a majority of bachelor's degrees.[214] The U.S. teenage pregnancy rate, 79.8 per 1,000 women, is the highest among OECD nations.[215] Between 2007 and 2010, the highest teenage birth rate was in Mississippi, and the lowest in New Hampshire.[216] Abortion is legal throughout the U.S., owing to Roe v. Wade, a 1973 landmark decision by the United States Supreme Court. While the abortion rate is falling, the abortion ratio of 241 per 1,000 live births and abortion rate of 15 per 1,000 women aged 15–44 remain higher than those of most Western nations.[217] In 2011, the average age at first birth was 25.6 and 40.7% of births were to unmarried women.[218] The total fertility rate (TFR) was estimated for 2013 at 2.06 births per woman.[219] Adoption in the United States is common and relatively easy from a legal point of view (compared to other Western countries).[220] In 2001, with over 127,000 adoptions, the U.S. accounted for nearly half of the total number of adoptions worldwide.[221] Same-sex marriage is legally performed in 16 U.S. states, 8 tribal jurisdictions, and the District of Columbia. Same-sex marriages were performed in Utah but the United States Supreme Court issued a stay and same-sex marriages are not currently performed in the state while the 10th Circuit Court of Appeals in Denver considers the case.[222] Oregon recognizes same-sex marriages performed in other jurisdictions. Ohio recognizes out-of-state marriages for death certificate purposes only.[223][224] Illinois has legalized same-sex marriage but it has not yet gone into effect. Same-sex marriage is currently legal in Illinois but only for same-sex couples in which at least one of them is terminally ill.[225] Polygamy is illegal in all 50 states.[226] Government and politics Main articles: Federal government of the United States, state governments of the United States, and elections in the United States U.S. Capitol seats the Congress: the Senate, left; the House, right The White House used by the U.S. President Supreme Court and offices for nine Justices The United States is the world's oldest surviving federation. It is a constitutional republic and representative democracy, \"in which majority rule is tempered by minority rights protected by law\".[227] The government is regulated by a system of checks and balances defined by the U.S. Constitution, which serves as the country's supreme legal document.[228] For 2012, the US ranked 21st on the Democracy Index[229] and 19th on the Corruption Perceptions Index.[230] In the American federalist system, citizens are usually subject to three levels of government: federal, state, and local. The local government's duties are commonly split between county and municipal governments. In almost all cases, executive and legislative officials are elected by a plurality vote of citizens by district. There is no proportional representation at the federal level, and it is very rare at lower levels. Political system of the United States The federal government is composed of three branches: Legislative: The bicameral Congress, made up of the Senate and the House of Representatives, makes federal law, declares war, approves treaties, has the power of the purse,[231] and has the power of impeachment, by which it can remove sitting members of the government.[232] Executive: The president is the commander-in-chief of the military, can veto legislative bills before they become law (subject to Congressional override), and appoints the members of the Cabinet (subject to Senate approval) and other officers, who administer and enforce federal laws and policies.[233] Judicial: The Supreme Court and lower federal courts, whose judges are appointed by the president with Senate approval, interpret laws and overturn those they find unconstitutional. The House of Representatives has 435 voting members, each representing a congressional district for a two-year term. House seats are apportioned among the states by population every tenth year. At the 2010 census, seven states had the minimum of one representative, while California, the most populous state, had 53.[234] The Senate has 100 members with each state having two senators, elected at-large to six-year terms; one third of Senate seats are up for election every other year. The president serves a four-year term and may be elected to the office no more than twice. The president is not elected by direct vote, but by an indirect electoral college system in which the determining votes are apportioned to the states and the District of Columbia.[235] The Supreme Court, led by the Chief Justice of the United States, has nine members, who serve for life.[236] The state governments are structured in roughly similar fashion; Nebraska uniquely has a unicameral legislature.[237] The governor (chief executive) of each state is directly elected. Some state judges and cabinet officers are appointed by the governors of the respective states, while others are elected by popular vote. The original text of the Constitution establishes the structure and responsibilities of the federal government and its relationship with the individual states. Article One protects the right to the \"great writ\" of habeas corpus, The Constitution has been amended 27 times;[238] the first 10 amendments, which make up the Bill of Rights, and the Fourteenth Amendment form the central basis of Americans' individual rights. All laws and governmental procedures are subject to judicial review and any law ruled by the courts to be in violation of the Constitution is voided. The principle of judicial review, not explicitly mentioned in the Constitution, was established by the Supreme Court in Marbury v. Madison (1803)[239] in a decision handed down by Chief Justice John Marshall.[240] Political divisions Main articles: Political divisions of the United States, U.S. state, Territories of the United States, and List of states and territories of the United States Further information: Territorial evolution of the United States and United States territorial acquisitions The United States is a federal union of 50 states. The original 13 states were the successors of the 13 colonies that rebelled against British rule. Early in the country's history, three new states were organized on territory separated from the claims of the existing states: Kentucky from Virginia; Tennessee from North Carolina; and Maine from Massachusetts. Most of the other states have been carved from territories obtained through war or purchase by the U.S. government. One set of exceptions includes Vermont, Texas, and Hawaii: each was an independent republic before joining the union. During the American Civil War, West Virginia broke away from Virginia. The most recent state—Hawaii—achieved statehood on August 21, 1959.[241] The states do not have the right to unilaterally secede from the union. The states compose the vast bulk of the U.S. land mass. The District of Columbia is a federal district which contains the capital of the United States, Washington D.C. The United States also possesses five major overseas territories: Puerto Rico and the United States Virgin Islands in the Caribbean; and American Samoa, Guam, and the Northern Mariana Islands in the Pacific.[242] Those born in the major territories are birthright U.S. citizens except Samoans. Samoans born in American Samoa are born U.S. nationals, and may become naturalized citizens.[243] American citizens residing in the territories have fundamental constitutional protections and elective self-government, with a territorial Member of Congress, but they do not vote for president as states. Territories have personal and business tax regimes different from that of states.[244] The United States also observes tribal sovereignty of the Native Nations. Though reservations are within state borders, the reservation is a sovereign. While the United States recognizes this sovereignty, other countries may not.[245] Map of USA with state names 2.svg About this image [show]Individual states and their dates of statehood Parties and elections Main articles: Politics of the United States and Political ideologies in the United States (from left to right) House Majority Leader Eric Cantor, House Minority Leader Nancy Pelosi, House Speaker John Boehner, President Barack Obama, Senate Majority Leader Harry Reid, Senate Minority Leader Mitch McConnell at the White House in 2011 The United States has operated under a two-party system for most of its history.[246] For elective offices at most levels, state-administered primary elections choose the major party nominees for subsequent general elections. Since the general election of 1856, the major parties have been the Democratic Party, founded in 1824, and the Republican Party, founded in 1854. Since the Civil War, only one third-party presidential candidate—former president Theodore Roosevelt, running as a Progressive in 1912—has won as much as 20% of the popular vote. The third-largest political party is the Libertarian Party. Within American political culture, the Republican Party is considered center-right or conservative and the Democratic Party is considered center-left or liberal.[247] The states of the Northeast and West Coast and some of the Great Lakes states, known as \"blue states\", are relatively liberal. The \"red states\" of the South and parts of the Great Plains and Rocky Mountains are relatively conservative. The winner of the 2008 presidential election and the 2012 presidential election, Democrat Barack Obama, is the 44th U.S. president. In the 113th United States Congress, the House of Representatives is controlled by the Republican Party, while the Democratic Party has control of the Senate. The Senate currently consists of 52 Democrats, two independents who caucus with the Democrats, and 46 Republicans; the House consists of 234 Republicans and 201 Democrats.[248] There are 30 Republican and 20 Democratic state governors.[249] Since the founding of the United States until 2000s, the country's governance has been primarily dominated by White Anglo-Saxon Protestants (WASPs). However, the situation has changed recently and of the top 17 positions (four national candidates of the two major party in the 2012 U.S. presidential election, four leaders in 112th United States Congress, and nine Supreme Court Justices) there is only one WASP.[250][251][252] Foreign relations Main articles: Foreign relations of the United States and Foreign policy of the United States See also: Covert United States foreign regime change actions The British Foreign Secretary, William Hague, and the U.S. Secretary of State, John Kerry, June 2013 The United States has established foreign relations. It is a permanent member of the United Nations Security Council, and New York City hosts the United Nations Headquarters. It is a member of the G8,[253] G20, and Organisation for Economic Co-operation and Development. Almost all countries have embassies in Washington, D.C., and many have consulates around the country. Likewise, nearly all nations host American diplomatic missions. However, Cuba, Iran, North Korea, Bhutan, and the Republic of China (Taiwan) do not have formal diplomatic relations with the United States (although the U.S. still supplies Taiwan with military equipment). The United States has a \"special relationship\" with the United Kingdom[254] and strong ties with Canada,[255] Australia,[256] New Zealand,[257] the Philippines,[258] Japan,[259] South Korea,[260] Israel,[261] and several European countries such as France and Germany. It works closely with fellow NATO members on military and security issues and with its neighbors through the Organization of American States and free trade agreements such as the trilateral North American Free Trade Agreement with Canada and Mexico. In 2008, the United States spent a net $25.4 billion on official development assistance, the most in the world. As a share of America's large gross national income (GNI), however, the U.S. contribution of 0.18% ranked last among 22 donor states. By contrast, private overseas giving by Americans is relatively generous.[262] The U.S. exercises full international defense authority and responsibility for three sovereign nations through Compact of Free Association with Micronesia, the Marshall Islands and Palau, all of which are Pacific island nations which were part of the U.S.-administered Trust Territory of the Pacific Islands beginning after World War II, and gained independence in subsequent years. Government finance See also: Taxation in the United States and United States federal budget Taxes are levied in the United States at the federal, state and local government level. These include taxes on income, payroll, property, sales, imports, estates and gifts, as well as various fees. In 2010 taxes collected by federal, state and municipal governments amounted to 24.8% of GDP.[263] During FY2012, the federal government collected approximately $2.45 trillion in tax revenue, up $147 billion or 6% versus FY2011 revenues of $2.30 trillion. Primary receipt categories included individual income taxes ($1,132B or 47%), Social Security/Social Insurance taxes ($845B or 35%), and corporate taxes ($242B or 10%).[264] U.S. taxation is generally progressive, especially the federal income taxes, and is among the most progressive in the developed world,[265][266][267][268][269][270] but the incidence of corporate income tax has been a matter of considerable ongoing controversy for decades.[271][272][273][274] In 2009 the top 10% of earners, with 36% of the nation's income, paid 78.2% of the federal personal income tax burden, while the bottom 40% had a negative liability.[269] However, payroll taxes for Social Security are a flat regressive tax, with no tax charged on income above $113,700 and no tax at all paid on unearned income from things such as stocks and capital gains.[275][276] The historic reasoning for the regressive nature of the payroll tax is that entitlement programs have not been viewed as welfare transfers.[277][278] The top 10% paid 51.8% of total federal taxes in 2009, and the top 1%, with 13.4% of pre-tax national income, paid 22.3% of federal taxes.[269] In 2013 the Tax Policy Center projected total federal effective tax rates of 35.5% for the top 1%, 27.2% for the top quintile, 13.8% for the middle quintile, and −2.7% for the bottom quintile.[279][280] State and local taxes vary widely, but are generally less progressive than federal taxes as they rely heavily on broadly borne regressive sales and property taxes that yield less volatile revenue streams, though their consideration does not eliminate the progressive nature of overall taxation.[267][281] During FY 2012, the federal government spent $3.54 trillion on a budget or cash basis, down $60 billion or 1.7% vs. FY 2011 spending of $3.60 trillion. Major categories of FY 2012 spending included: Medicare & Medicaid ($802B or 23% of spending), Social Security ($768B or 22%), Defense Department ($670B or 19%), non-defense discretionary ($615B or 17%), other mandatory ($461B or 13%) and interest ($223B or 6%).[264] Public "; // result will be an iterator over tuples containing the start and end indices for each match in the string let result = regex.captures_iter(string); for mat in result { println!("{:?}", mat); } }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/