/^([a-z]:)?\//i
I don't quite understand what the ?
in this regex if I had to explain it from what I understood:
Match begin "Group1 is a to z and :" outside ?
(which I don't get what its doing) \/
which makes it match /
and option /i
"case insensitive".
I realize that this will return 0 or 1 not quiet sure why because of the ?
Is this to match directory path or something ?
If I test it:
$var = 'test'
would get 0 while $var ='/test';
would get 1 but $var = 'test/'
gets 0
So anything that begins with /
will get 1 and anything else 0.
Can someone explain this regex in elementary terms to me?