Extract patterns from text