JavaScript (ES6), 114 bytes
Expects (N,n,o) and returns false for strange, true for regular, 2 for wrong.
(N,n,o)=>(U="toUpperCase",g=(x,y=U[+!x])=>~N--?g(n--?y:y=p=y[U](),x&&x+y):s=x.substr(o,p.length))()[U]()==p?s==p:2
Method
We recursively build all patterns \$F_0\$ to \$F_N\$ using letters in lower case (ironically using the 'o' and 't' from the string 'toUpperCase' for golfing reasons).
When \$F_n\$ is reached, we convert it to upper case, save it in \$p\$ and use the transformed string for the recursion. All subsequent regular occurrences of \$p\$ will therefore appear in upper case as well.
At the end of the process, we look for \$p\$ at offset \$o\$ in \$F_N\$:
- If \$p\$ appears in upper case, this is a regular match.
- If \$p\$ appears in lower or mixed case, this is a strange match.
- If \$p\$ doesn't appear at all, this is obviously wrong.
Commented
(N, n, o) => // input values
( U = "toUpperCase", // store "toUpperCase" in U
g = ( // g is a recursive function taking:
x, // a string x
y = U[+!x] // a string y initialized to "o" if x
// is undefined or "t" is x is defined
) => // (for the first 2 iterations)
~N-- ? // if N is not equal to -1
// (decrement N afterwards):
g( // do a recursive call:
n-- ? // if n is not equal to 0
// (decrement n afterwards):
y // use y unchanged
: // else:
y = p = y[U](), // update y and p to y in upper case
x && x + y // if x is defined, pass x + y
// (pass undefined otherwise)
) // end of recursive call
: // else:
s = // save in s and return ...
x.substr(o, p.length) // ... the relevant slice of x
)() // invoke g with x and y undefined
[U]() == p ? // if the result in upper case matches p:
s == p // compare s with p (Boolean value)
: // else:
2 // return 2
- 205.5k
- 21
- 187
- 670