| 197 |
that is going to be matched in this way with a variable repeat. |
that is going to be matched in this way with a variable repeat. |
| 198 |
</P> |
</P> |
| 199 |
<P> |
<P> |
| 200 |
Last updated: 28 February 2005 |
4. Patterns that contain alternatives at the top level which do not all |
| 201 |
|
start with the same pattern item may not work as expected. For example, |
| 202 |
|
consider this pattern: |
| 203 |
|
<pre> |
| 204 |
|
1234|3789 |
| 205 |
|
</pre> |
| 206 |
|
If the first part of the subject is "ABC123", a partial match of the first |
| 207 |
|
alternative is found at offset 3. There is no partial match for the second |
| 208 |
|
alternative, because such a match does not start at the same point in the |
| 209 |
|
subject string. Attempting to continue with the string "789" does not yield a |
| 210 |
|
match because only those alternatives that match at one point in the subject |
| 211 |
|
are remembered. The problem arises because the start of the second alternative |
| 212 |
|
matches within the first alternative. There is no problem with anchored |
| 213 |
|
patterns or patterns such as: |
| 214 |
|
<pre> |
| 215 |
|
1234|ABCD |
| 216 |
|
</pre> |
| 217 |
|
where no string can be a partial match for both alternatives. |
| 218 |
|
</P> |
| 219 |
|
<P> |
| 220 |
|
Last updated: 16 January 2006 |
| 221 |
<br> |
<br> |
| 222 |
Copyright © 1997-2005 University of Cambridge. |
Copyright © 1997-2006 University of Cambridge. |
| 223 |
<p> |
<p> |
| 224 |
Return to the <a href="index.html">PCRE index page</a>. |
Return to the <a href="index.html">PCRE index page</a>. |
| 225 |
</p> |
</p> |