IMO the presence of gas affects the feeling of urgency.
I have issues with lactose and gluten. When I cheat and eat ice cream, bread, pasta or any food that is a big gas-producer (e.g. beans, broccoli), I notice that there is more probability of urgency and the need to make more bathroom trips.
I have experimented with Beano, Gas-x and digestive enzymes but nothing works as well as avoiding problem foods.
That being said, you only live once......I recently enjoyed a local ethnic food event celebrating Polish, Lithuanian and Slovakian food. I ate some of everything but knew that I was going to stay home the next day. Took 3 doses of slippery elm...am, noon and pm to normalize.