My son id the same type of thing, but his vomit was not like his stomache contents, it was more milky white. Anyway, it turns out he was having mild seizures which caused him to be nauseaus and then vomit. To this day, that is the major indicator that he had a seizure. They always seem to happen roughly at the same time (around 3 am.) If he went to bed an hour later, his vomiting would be an hour later - like it was related to his sleep pattern or stages.
It took us a while to figure it out, so it might be worth investigating. People may think you don't know what you're talking about, but I know my son!!
It is not likely that this is related to anxiety, particulalrly if it is not accompanied by hard crying or any panic type response. It would be wise to ask your pediatrician for a referral to a pediatric gastroenterologist.