You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by bu...@apache.org on 2003/03/31 14:20:01 UTC

DO NOT REPLY [Bug 18515] New: - Line anchor does not work when match starts at index > 0

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18515>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18515

Line anchor does not work when match starts at index > 0

           Summary: Line anchor does not work when match starts at index > 0
           Product: Regexp
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Other
        AssignedTo: regexp-dev@jakarta.apache.org
        ReportedBy: peter.hendry@capeclear.com


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.

---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org