This machine mirrors various open-source projects.
20 Gbit/s uplink.
If there are any issues or you want another project mirrored, please contact
mirror-service -=AT=- netcologne DOT de !
aaaaaa....aaaa
(100 × "a")b
/ a*b
/ a*a*b
/ … a*a*a*…a*b
(N × "a*", "b")bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length && pat[p] == str[s]) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
return matches_at(str, 0, pat, 0);
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
return matches_at(str, 0, pat, 0);
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
return matches_at(str, 0, pat, 0);
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
return matches_at(str, 0, pat, 0);
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches(string str, string pat) {
return matches_at(str, 0, pat, 0);
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
matches("aaaaaaaaaa", "a*a*a*a*b")
a* # loop: s .. str.length / 1 .. 10
a* # loop: s .. str.length / 2 .. 10
a* # loop: s .. str.length / 3 .. 10
a* # loop: s .. str.length / 4 .. 10
b # fail: backtrack
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s <= str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s < str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
return matches_at(str, s, pat, p+1);
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s < str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
p++;
next;
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s < str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
p++;
next;
} else if (s < str.length &&
(pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s < str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
for (; s < str.length; s++) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
while (s < str.length) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
s++;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
s++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
s++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
s++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
if (matches_at(str, s, pat, p+1)) {
return true;
}
s++;
cont.push([s+1, p]);
p++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
p++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
p++;
next;
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
bool matches_at(string str, int s, string pat, int p) {
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
*
tries to match shorter strings first…*…*…*
for the first time, all preceding *
have consumed as little of the string as possible*
, there's no point in having the preceding stars try to match more*
bool matches(string str, string pat) {
int s = 0, p = 0;
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
cont.clear();
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
stack cont;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
cont.clear();
if (s < str.length) {
cont.push([s+1, p]);
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (!cont.empty()) {
[s, p] = cont.pop();
next;
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
int cont_s = -1, cont_p;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
cont_s = -1;
if (s < str.length) {
[cont_s, cont_p] = [s+1, p];
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (cont_s != -1) {
[s, p] = [cont_s, cont_p];
next;
}
return false;
}
return true;
}
bool matches(string str, string pat) {
int s = 0, p = 0;
int cont_s = -1, cont_p;
while (s < str.length || p < pat.length) {
if (p < pat.length) {
if (pat[p] == '*') {
cont_s = -1;
if (s < str.length) {
[cont_s, cont_p] = [s+1, p];
}
p++;
next;
}
if (s < str.length && (pat[p] == '?' || pat[p] == str[s])) {
s++; p++;
next;
}
}
if (cont_s != -1) {
[s, p] = [cont_s, cont_p];
next;
}
return false;
}
return true;
}
sub glob2re {
my ($pat) = @_;
return qr/\A\Q$pat\E\z/;
}
"aaaaaaaaaa" =~ glob2re("a*a*a*b*");
# same exponential backtracking problems
sub glob2re {
my ($pat) = @_;
$pat = quotemeta $pat;
return qr/\A$pat\z/;
}
"aaaaaaaaaa" =~ glob2re("a*a*a*b*");
# same exponential backtracking problems
sub glob2re {
my ($pat) = @_;
$pat =~ s/(\W)/\\$1/g;
return qr/\A$pat\z/;
}
"aaaaaaaaaa" =~ glob2re("a*a*a*b*");
# same exponential backtracking problems
sub glob2re {
my ($pat) = @_;
$pat =~ s/(\W)/
$1 eq '*' ? '.*?' :
$1 eq '?' ? '.' :
"\\$1"
/eg;
return qr/\A$pat\z/s;
}
"aaaaaaaaaa" =~ glob2re("a*a*a*b*");
# same exponential backtracking problems
sub glob2re {
my ($pat) = @_;
$pat =~ s/(\W)/
$1 eq '*' ? '(*PRUNE).*?' :
$1 eq '?' ? '.' :
"\\$1"
/eg;
return qr/\A$pat\z/s;
}
"aaaaaaaaaa" =~ glob2re("a*a*a*b*");
# fixed!
# same exponential backtracking problems
*
{END,FIN}{E,}
(END|FIN)E?