Halfway through February, I could no longer sleep through the night. At 2 a.m., I’d find myself chugging milk from the carton to extinguish a fire at the top of my rib cage. The gnawing feeling high in my stomach alternated with nausea so arresting I kept a bucket next to my laptop and considered taking a pregnancy test, even though I was 99 percent sure I wasn’t expecting.

One day on the subway platform, I doubled over and let out a groan so pathetic it prompted a complete stranger to ask, “Are you all right?” Then I knew it was time to seek medical attention. New Yorkers don’t address strangers on the subway, I told myself. It’s like breaking the fourth wall.

The next day, my primary care doctor told me I probably had an ulcer, a raw spot or sore in the lining of the stomach or small intestine. Here are some of the things I learned about ulcers during the odyssey that followed.

■ Anyone can get an ulcer. Back in the 1980s, when doctors and most everyone else thought psychological stress or spicy foods led to ulcers, two Australian scientists discovered that the main culprit was actually a bacterium called Helicobacter pylori. That discovery eventually won them a Nobel Prize in 2005, and ushered in an era of using antibiotics to cure ulcers.