Find out how to use yoga for soreness and different ways to modify your practice.
In the classical eightfold path of yoga, it is no accident that ahimsa (nonviolence) is the first yama (restraint) to observe—ahimsa is the heart and essence of yoga. When we sustain an injury, we have distanced ourselves from this concept. However, an injury offers a chance to return to the place of compassion, sweetness, and patience that ahimsa encourages.
It is crucial to avoid reinjuring yourself. This does not mean you must stop practicing, but you should modify your practice. Try to assess the origin of your injury—maybe your hamstrings are weak and your quadriceps are not working to support them. Or maybe your knees hyperextend or you've been lifting and spreading the sitting bones too much.
Hamstring pulls respond well to strengthening work, so you might want to work with bent-leg standing poses, like Utkatasana (Chair Pose) and Virabhadrasana I and II (Warrior Pose I and II); increase the amount of time you normally hold them for. Also do backbending poses, like Salabhasana (Locust Pose) and Dhanurasana (Bow Pose), which more specifically teach you how to contract and lift the hamstrings.
If your knees hyperextend (or to find out if they do), come into Uttanasana (Standing Forward Bend) with your heels and the backs of your legs against a wall. Press down through the four corners of the feet evenly and lift the inner and outer ankles. Work to lift and engage both the fronts and the backs of your legs. If your calves touch the wall first, learn to move the tops of the thighs to the wall faster then the calves. This will teach you to correctly stack the upper and lower legs.
If the pain is close to where the hamstring attaches to the sitting bone, you may be lifting or spreading your sitting bones too far apart. Tie a belt around the injured area. In Uttanasana, keep the hips directly over your heels and firm the sides of your thighs toward the centerline of your body. Avoid overextending the muscle by drawing the fronts and backs of the thighs up evenly.
In seated asanas, place a folded sticky mat under your knee. This will alleviate the pain and prevent reinjury. Spread your calves to widen the backs of the knees and learn to ground your femurs.
And remember: Injuries are best healed under the guidance of a qualified teacher.