such as是介词,后跟名词或动名词;for example是副词短语,后可用词、短语或句子。另外,for example用在句中时前后都要有逗号。
例:
1. But unlike books such as Harry Potter, His Dark Materials explores deeper and darker moral territory. 不像哈利波特这样的书,His Dark Materials探索更深更阴暗的道德领域。 (BBC)
2. In 1910, for example, nearly 15% of people in the U.S. were born in another country. 例如,在1910年,接近15%的美国人出生在别的国家。(CNN)