You can combine lines 11 and 12 by separating your different validations with commas:
validates :username, :uniqueness => true, :format => { :with => /^[a-zA-Z0-9_]+$/ }