core: lang use characters before `#` or ' ' as id and discard the rest

This strips the id and only takes the characters before # or `<Space>` whichever comes first as the id. 

closes #881