I've had this for ages (I had IBS before I got pregnant). Drinking lots of water helps a bit, as does avoiding windy foods (beans, too much bread, onions etc). I found, when I was first diagnosed (it's got better since, mercifully) that about the only carbohydrate I could cope with was rice (and it had to be brown rice).