Can I grow my peppers from seeds in a store bought pepper?

I’ve successfully grown peppers from the seeds of store bought jalapenos. Also, bell pepper seeds are a minor nuisance in my compost since they keep sprouting in there and contaminating my beds when I add in new soil.