The function is_match() in the regex library is supposed to tell you if your pattern (the needle) matches the entire subject (the haystack).
However, it takes an optional "from" parameter -- the subscript to start matching on the subject. In other words, the haystack doesn't always really start at position 1. If there is a successful pattern match, the function checks to see if the returned match starts with 1 and ends at length(haystack), in which case it returns true, else false.
But if the "from" parameter is set to anything other than 1, then is_match() will always return false because even if there is a match, the start will never be 1 because it can't be less than "from", which is greater than 1.
Therefore, this line:
if sequence(m) and length(m) > 0 and m[1][1] = 1 and m[1][2] = length(haystack) then
should instead be:
if sequence(m) and length(m) > 0 and m[1][1] = from and m[1][2] = length(haystack) then
with documentation updated to note that the "entire haystack" is to be [from..$] rather than always [1..$].
Either that, or drop the "from" parameter as it makes no sense. Possibly that is what was intended in the first place.
He is right.
changeset: 4735:1768651497c1 branch: 4.0 user: Shawn Pringle <shawn.pringle@gmail.com> date: Wed Mar 09 16:17:58 2011 -0300 files: docs/release/4.0.1.txt description:
Note that due to major regressions, commits for this ticket have been removed from the tip of the repository.
changeset: 4745:05416383a492 branch: 4.0 user: Matt Lewis date: Fri Mar 11 12:44:06 2011 -0500 files: docs/release/4.0.1.txt include/std/regex.e description: