This is a homework for postgresql regular expression that is to write a regular expression meeting the following requirement: Lines that have three upper case characters in parenthesis like (LTI) - remember to escape certain characters. I wrote the expression: purpose, ([A-Z]{3}). the answer is supposed to be 3 rows, but I got only 2 rows with my query. I don't why and solution. the purpose as followed:
we are dedicated to animal welfare and preventing cruelty to stray, abandoned or abused dogs and cats in Harris and Montgomery counties of texas. We will focus our efforts on Trap Neuter and Return(TNR) of cats and helping cats and dogs in need. We have established a sanctuary for animals that can't be adopted due to medical condition or age. These activities will be conducted by board members, the volunteers and members of the organization. We will provide shelter, water, food and medical care and rehabilitation for animals in need. Medical care will be performed by local veterinarians and will include but not limited to sterilization, vaccinations, testing for disease, as well any other medical care recommended by the Vet to promote the health of the animal. We focus on animals in need in Harris and Montgomery county Texas. We perform TNR which is common practice in cat rescue. We trap stray animals and spay/neuter/vaccinate and vetted and return them to their location if possible. We also sponsor free cat and dog sterilazation service to residents of the counties. We also offer a voucher system for residents in need who can't afford sterlization services. We also devote our efforts to animals in the 5th ward of Houston which is a low income area. We also offer residents of this area with pet food, vetting and pet care as needed. Our first and foremost goal is to educate and assist area residents who may need help understanding how to better care for their pets and who may need economic assitance to ensure their pets receive essential medical care. We provide residents with vouchers that cover the complete cost of having animals altered and vaccinated against rabies and common diseases. In addition we provide vaccinations and worming in the field free of charge. We also assist residents in placing unwanted puppies born in the area and work with those who own the many chained dogs we observe to provide shelter to protect them from the elements.137186 the National Coalition for History (NCH) advocates on federal legislative and regulatory issues affecting historians, archivists, teachers, researchers, and other stakeholders. Since 1982, the National Coalition for History (formerly the National Coordinating Committee for the Promotion of History) has served as the voice for the historical and archival professions in Washington, DC. The history coalition is a non-profit organization organized under Section 501(c)(3) of the Internal Revenue Code. NCH is solely supported by contributions from its member organizations and the general public. operation of a commercial paper program for the benefit of california state university (CSU) to enhance the capital financing for projects, equipment, and facilities serving csu.
I am wondering what's wrong with my expression and the solution. thanks
CodePudding user response:
Your expression ([A-Z]{3})
matches 3 uppercase letters and captures them as a group, ie ABC would be matched from "abc ABC abc" (with or without brackets).
To match literal brackets you must escape them:
\([A-Z]{3}\)