Sure, try and do whole grain pasta though and just watch the serving size and what you put on it.
Really, most foods are fine if you know how much calories you are eating and you are in control of what you are eating.
Obvious stuff like cookies and ice cream aren't good but pretty much anything else can be done. Just know what you are eating and how much and make sure it fits into your plan.
Of course it all depends on your goals too. If you are cutting from 11% body fat down to single digits, you aren't going to get away with as much food like pasta as you would cutting from 25% body fat to 15%... or if you are on a bulk, you can probably get away with eating more pasta than on a cut.
A lot of it comes down to personal genetics too. Some people can cut while eating Dairy Queen Blizzards. The best thing you can do to find out if you can eat pasta is to try it. Track everything you eat and your progress. After a couple weeks, you will know how replacing rice with pasta a few times a week effects you. If your weight loss slows or stops, then you know what you are doing didn't work. A lot is going to come down to personal experience and experimentation... just keep good records so you know how to interpret what is going on.