<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - BASIC-Editor: Matching start-of-line using a lone ^ does not work"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=132870#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - BASIC-Editor: Matching start-of-line using a lone ^ does not work"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=132870">bug 132870</a>
from <span class="vcard"><a class="email" href="mailto:jim.avera@gmail.com" title="Jim Avera <jim.avera@gmail.com>"> <span class="fn">Jim Avera</span></a>
</span></b>
<pre><span class="quote">> 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</span >
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*.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>