Internal Regex example added.
This commit is contained in:
parent
135577fee9
commit
c69b3fa872
|
@ -0,0 +1,20 @@
|
|||
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");
|
||||
}
|
Loading…
Reference in New Issue