<commit_before>// Copyright 2013 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package validation provide utilities functions for data validation.
package validation

import (
	"regexp"
)

func ValidateEmail(email string) bool {
	re := regexp.MustCompile(`^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$`)
	return re.MatchString(email)
}

// ValidateLength checks whether the given data match the given rules.
//
// It checks if the value has more or equal `min` chars and less or equal `max`
// chars. If you don't want to check both, just pass a zero value:
//
//     ValidateLength(value, 0, 100) // Checks if value has at most 100 characters
//     ValidateLength(value, 100, 0) // Checks if value has at least 100 characters<commit_msg>validation: simplify import statement<commit_after>// Copyright 2015 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package validation provide utilities functions for data validation.
package validation

import "regexp"

func ValidateEmail(email string) bool {
	re := regexp.MustCompile(`^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$`)
	return re.MatchString(email)
}

// ValidateLength checks whether the given data match the given rules.
//
// It checks if the value has more or equal `min` chars and less or equal `max`
// chars. If you don't want to check both, just pass a zero value:
//
//     ValidateLength(value, 0, 100) // Checks if value has at most 100 characters
//     ValidateLength(value, 100, 0) // Checks if value has at least 100 characters
{'fraction_non_alphanumeric': 0.11942959001782531, 'fraction_numerical': 0.024955436720142603, 'mean_word_length': 3.6391184573002753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6241242', 'n_tokens_mistral': 529, 'n_tokens_neox': 487, 'n_words': 218}