Bloating is usually caused by an overgrowth of bad gut flora and a lack of the good. It can also be caused by food allergies and sensitivities. You mention pasta. Wheat is one of the major offenders and carbs in general feed the bad gut bugs, making an overgrowth worse.
The best way to treat it is to identify and eliminate offending foods, restore good gut flora with probiotics, improve digestion with enzymes and/or address any overgrowth (often it's candida) with antifungals. Check out Elson Haas' book The False Fat Diet to learn more. It was an eye opener for me. And yes, my mother once asked me if I was pregnant.
Diagnosed with ulcerative colitis spring 1999.
Maintenance dose sulfasalazine. Probiotics, l-glutamine, vitamin D and fish oil caps. George's aloe vera juice. Oregano oil antibiotic, antiviral, antifungal. Mostly grain-free and dairy-free diet. Long-term remission with only minor blips.