Comments (3)
I always thought Perl's treatment of {,3} as a literal was an enormous gotcha, since it accepted {,3} as a qualifier. Now it treats {,3} as {0,3} which seems more reasonable. I think we should now stick with Perl compatibility but yes, add something to the docs. Anybody who cares about compatibility between engines would probably never write {,3} anyway -- they would make it clear as either {0,3} or {,3}.
from pcre2.
I always thought Perl's treatment of {,3} as a literal was an enormous gotcha
FWIW, somewhat recent versions of perl (ex: 5.30) show an error instead:
% /usr/bin/perl -e 'shift =~ /x{,3}/' 'x'
Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/x{ <-- HERE ,3}/ at -e line 1.
Anybody who cares about compatibility between engines would probably never write {,3} anyway
At least Python, Ruby and GNU RegEx seem to interpret that qualifier just like recent Perl, so I agree.
Still the fact that this is possible AND seems to match the behaviour in other engines is worth recognizing on its own:
$ perl -e 'print "$]: $1\n" if shift =~ /(x{0, 3})/' 'x{0, 3}'
5.020002: x{0, 3}
% perl -e 'print "$]: $1\n" if shift =~ /(x{0, 3})/' 'x{0, 3}'
5.036001: x
from pcre2.
I have added a few words to the doc, pointing out that other engines may behave differently.
from pcre2.
Related Issues (20)
- `pcre2grep -M` with anchored pattern matches not on the whole input - or only once HOT 7
- Another recursion inconsistency corner case HOT 17
- Malformed pcre2demo(3) man page destroys apropos readability HOT 1
- Install fails with `INSTALL_MSVC_PDB=ON` and `-G "Visual Studio XXX"`
- On Linux, pages are marked as simultaneously writable and executable HOT 5
- New release/roadmap HOT 3
- ld.lld: error: undefined symbol: _pcre2_default_tables_8 HOT 1
- Allocation of a negative number of bytes HOT 3
- PCRE2_DISABLE_RECURSELOOP_CHECK missing in pcre2.h.generic HOT 2
- Loss of data warnings on Visual Studio HOT 3
- Website problem: http to https redirections do not configurated HOT 2
- Several old links on pcre.org website
- Old files on pcre.org HOT 2
- MSVC warnings with 10.43 HOT 1
- Allow unlimited subpattern name length HOT 4
- SunOS-5.11-SPARC - "src/pcre2.h", line 949: warning: no explicit type given HOT 5
- pcre2 makes software crash when GDS mitigation is forced for older CPUs HOT 22
- Invalid size 0 may lead to undefined behavior / infinite loop HOT 1
- Atomic group must not increase stack depth HOT 1
- Probable thread-safety issue in pcre2 10.43+ HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pcre2.