When using the RE.match( String text, int pos ) method with a pattern that uses the start of line anchor '^', the match does not work from the start location. For example, if I have the pattern "^el" and I run match( "hello", 1 ) then the match should succeed as the start location is effectively the start of the string I want matched against (i.e. the use for this is to save doing a substring and passing the result instead of the whole string and an index). With the current functionality it only succeeds as a start-of-line for index == 0. The corresponding line of code is case OP_BOL: // Fail if we're not at the start of the string if (idx != 0) I have done a fix that records that startPos in match(String, int) and compares idx to this but do not know if this would have any side-effects so have not included it as a fix. Without this functionality the usefulness of this version of the match method is reduced.
In this case jakarta-regexp behaves the same way as gnu-regexp library and Sun's java.util.regex. It looks like they consider RE.match(int) (in jakarta&gnu) and Matcher.find(int) (in java.util.regex) as a way to repeat search from some position but not as search in substring. Ans so, they do not match starting position as line start. I'd say this bug should be closed as not a bug. BTW, there is a simple workaround: use RE.match(string.substring(position)) instead of RE.match(string, position) if you want match start of substring as start of line.
Marking as WONTFIX