/*The following trailing characters can be used:
 *  i, letters in the pattern match both upper- and lowercase letters
 *  m, the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the string, respectively, as well as at the very start and end.
 *  s, a dot metacharater . in the pattern matches all characters, including newlines. Without it, newlines are excluded.
 *  x, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class. 
 */
bool is_valid_email(string email) {
	var status = true;
	stdout.puts(@"$email is ");
	if(! /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.match(email)) {
		stdout.puts("not ");
		status = false;
	}
	stdout.puts("valid email address.\n");
	return status;
}


void main () {
	is_valid_email("backbone@backbone.ws");
	is_valid_email("abrakadabra@@@lksdfj");

	var r = /(_name_|_NAME_|_Name_)/;
	var s = r.replace("My name is _NAME_", -1, 0, "Kolan");
	stdout.puts(@"$s\n");
}
