Getting before first underscore : Given a string say prod175100210_cat40510788__ I want only prod175100210. But when I do prod.*[^_] This regex, doesnot work. What should be legit regex for extracting only before first under score.