Cure for headaches

My OB advised me to take regular strength Tylenol and drink Pepsi or coke when I do for headaches but I thought caffeine should be avoided during pregnancy??