forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7dc13a0
committed
Change regex \D and \W shorthands to always match newlines.
Newline is certainly not a digit, nor a word character, so it issensible that it should match these complemented character classes.Previously, \D and \W acted that way by default, but innewline-sensitive mode ('n' or 'p' flag) they did not match newlines.This behavior was previously forced because explicit complementedcharacter classes don't match newlines in newline-sensitive mode;but as of the previous commit that implementation constraint nolonger exists. It seems useful to change this because the primaryreal-world use for newline-sensitive mode seems to be to match thedefault behavior of other regex engines such as Perl and Javascript... and their default behavior is that these match newlines.The old behavior can be kept by writing an explicit complementedcharacter class, i.e. [^[:digit:]] or [^[:word:]]. (This meansthat \D and \W are not exactly equivalent to those strings, butthey weren't anyway.)Discussion:https://postgr.es/m/3220564.1613859619@sss.pgh.pa.us1 parent2a0af7f commit7dc13a0
File tree
4 files changed
+36
-17
lines changed- doc/src/sgml
- src
- backend/regex
- test/modules/test_regex/expected
4 files changed
+36
-17
lines changedLines changed: 20 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6323 | 6323 |
| |
6324 | 6324 |
| |
6325 | 6325 |
| |
6326 |
| - | |
| 6326 | + | |
| 6327 | + | |
6327 | 6328 |
| |
6328 | 6329 |
| |
6329 | 6330 |
| |
6330 | 6331 |
| |
6331 |
| - | |
| 6332 | + | |
| 6333 | + | |
6332 | 6334 |
| |
6333 | 6335 |
| |
6334 | 6336 |
| |
6335 | 6337 |
| |
6336 |
| - | |
| 6338 | + | |
| 6339 | + | |
6337 | 6340 |
| |
6338 | 6341 |
| |
6339 | 6342 |
| |
6340 | 6343 |
| |
6341 |
| - | |
| 6344 | + | |
| 6345 | + | |
6342 | 6346 |
| |
6343 | 6347 |
| |
6344 | 6348 |
| |
6345 | 6349 |
| |
6346 |
| - | |
| 6350 | + | |
| 6351 | + | |
6347 | 6352 |
| |
6348 | 6353 |
| |
6349 | 6354 |
| |
6350 | 6355 |
| |
6351 |
| - | |
| 6356 | + | |
| 6357 | + | |
6352 | 6358 |
| |
6353 | 6359 |
| |
6354 | 6360 |
| |
| |||
6813 | 6819 |
| |
6814 | 6820 |
| |
6815 | 6821 |
| |
6816 |
| - | |
6817 |
| - | |
| 6822 | + | |
| 6823 | + | |
6818 | 6824 |
| |
6819 | 6825 |
| |
6820 | 6826 |
| |
6821 | 6827 |
| |
6822 | 6828 |
| |
6823 | 6829 |
| |
| 6830 | + | |
| 6831 | + | |
| 6832 | + | |
| 6833 | + | |
| 6834 | + | |
| 6835 | + | |
6824 | 6836 |
| |
6825 | 6837 |
| |
6826 | 6838 |
| |
|
Lines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
804 | 804 |
| |
805 | 805 |
| |
806 | 806 |
| |
807 |
| - | |
| 807 | + | |
808 | 808 |
| |
809 | 809 |
| |
810 | 810 |
| |
| |||
817 | 817 |
| |
818 | 818 |
| |
819 | 819 |
| |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
820 | 825 |
| |
821 | 826 |
| |
822 | 827 |
| |
|
Lines changed: 2 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1407 | 1407 |
| |
1408 | 1408 |
| |
1409 | 1409 |
| |
1410 |
| - | |
1411 |
| - | |
1412 |
| - | |
1413 |
| - | |
1414 | 1410 |
| |
1415 | 1411 |
| |
1416 | 1412 |
| |
| |||
1612 | 1608 |
| |
1613 | 1609 |
| |
1614 | 1610 |
| |
| 1611 | + | |
| 1612 | + | |
1615 | 1613 |
| |
1616 | 1614 |
| |
1617 | 1615 |
| |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2144 | 2144 |
| |
2145 | 2145 |
| |
2146 | 2146 |
| |
2147 |
| - | |
| 2147 | + | |
| 2148 | + | |
2148 | 2149 |
| |
2149 | 2150 |
| |
2150 | 2151 |
| |
| |||
2159 | 2160 |
| |
2160 | 2161 |
| |
2161 | 2162 |
| |
2162 |
| - | |
| 2163 | + | |
| 2164 | + | |
2163 | 2165 |
| |
2164 | 2166 |
| |
2165 | 2167 |
| |
| |||
2202 | 2204 |
| |
2203 | 2205 |
| |
2204 | 2206 |
| |
2205 |
| - | |
| 2207 | + | |
| 2208 | + | |
2206 | 2209 |
| |
2207 | 2210 |
| |
2208 | 2211 |
| |
| |||
2217 | 2220 |
| |
2218 | 2221 |
| |
2219 | 2222 |
| |
2220 |
| - | |
| 2223 | + | |
| 2224 | + | |
2221 | 2225 |
| |
2222 | 2226 |
| |
2223 | 2227 |
| |
|
0 commit comments
Comments
(0)