[Libreoffice-bugs] [Bug 132870] BASIC-Editor: Matching start-of-line using a lone ^ does not work

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Jul 31 22:16:35 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=132870

--- Comment #5 from Jim Avera <jim.avera at gmail.com> ---
> Consider the String "5a". If I search using the regex "[0-9]*", I should get 3 > matches: 
> - 0 to 1, which is 5
> - 1 to 1 and 2 to 2, which is empty

Could you clarify what you meant by "1 to 1" and "2 to 2"?  

The regex [0-9]* should always match anything (or nothing) because it means
"zero or more digits".  It will match as many digits as it can while still
allowing subsequent regex terms to match (in this example, there are no other
terms).

At each step during matching, the current regex term must succeed at the
current position of the input; if it does, then the next regex term is tried
etc. until all terms match.  If a regex term fails, then the engine has to
BACKTRACK and try a different choice in a previous regex term, if any (if there
is no previous term or all choices have been tried, then the overall match
fails).

In this case, since the regex can succeed matching zero characters, it will (or
should) match at any position of any input string, *even an empty input
string*.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200731/4246adcf/attachment.htm>


More information about the Libreoffice-bugs mailing list