In recent versions of OS X text selection within QuickLook should be enabled by default. If it is not enabled, or for some reason ceases being enabled on your Mac computer, this Terminal command will likely resolve the issue:

defaults write QLEnableTextSelection -bool true && killall Finder

With this enabled you should be able to select text from all recognised files with text content (such as .txt, .doc, .pdf, etc.).