Temporary fix for nested forms.  Regexp was grabbing earliest possible nested form, add $ to match EOL.  May need more complicated matching for deeply nested habtm forms.