The sentence is from the book Harry Potter. I can probably get the meaning of the sentence, but the grammar really confuses me, especially the usage of the word as. I could understand if the sentence was written as: It's they that should be sorry! More context:
"Sorry?" barked Hagrid, turning to stare at the Dursleys, who shrank back into the shadows. "It's them as should be sorry! ... ...
Can someone help to explain that sentence structure and grammar point? Thanks!
This is an older meaning of "as" that is now only found in some dialects. It is a relative conjunction, or perhaps a relative pronoun, and it means "that". It is not standard English (so don't use it). Standard English uses "that".
It is sense 9 in the wiktionary definition as
Rowling uses this to establish the character of Hagrid as it a marker of region (Hagrid is from the West Country), and class (Dumbledore was also West Country or Gloucestershire, but had lost the accent). It marks Hagrid as very different from the way people speak in Little Whinging in Surrey.
Hagrid also uses the object form "them" as the complement of the verb "is". This is standard English, though using the subject form "they" would also be correct. (Saying "It is they" applies Latin grammar, which does always use the nominative case for this)
People often don't speak grammatically correctly (or standard English, he talks with a west country style).
This is one of those times. Hagrid is a big friendly not very educated person, this phrase confirms that.
Your analysis of the meaning is correct.
It's they that should be sorry!
I would actually say:They are the ones who should be sorry!
 he was thrown out of Hogwarts early.