Any persistent chest pains should be checked out by your primary care doctor
, precisely because of the concern that any type of chest pain could be from a heart problem.
Generally speaking, twinges of chest pain that are sharp and fleeting, like those you are experiencing, are unlikely to be from a heart problem. They are more likely to be from a musculoskeletal source, either from strain of the muscles between the ribs or from inflammation of the joints connecting the ribs to the sternum.
However, this does not mean that you shouldn't get a check up with your doctor, because sometimes heart problems can have vague symptoms. Your doctor can perform a complete check up and, if there is any concerns for a heart problem, they will order additional testing, which might include an electrocardiogram, basic blood tests, or a stress test.
Make sure to mention any of the following serious symptoms to your doctor, as they would be more concerning for a heart problem: shortness of breath, palpitations, swelling in the ankles, trouble sleeping flat at night, chest pain with exercise, sweating, pain that radiates out of the chest to the back or the arm or the jaw, or fainting
Go see your doctor as soon as possible!