Comments (5)
If you using pcre_exec
, that means you are using PCRE1, which is not maintained anymore, and it will never see another release. Anyway, the problem is not with pcre1, because PCRE2 also throws PCRE2_ERROR_MATCHLIMIT. This pattern is 2^n
exponential pattern on this particular input because both \s
and dot matches to space. To avoid long runs, the engine exits at some point.
Because '.|\s' essentially matches to all characters, you can simply enable dotall temporarily for the dot character: a(?s:.)*?asdf
.
from pcre2.
๐คจ๐
from pcre2.
Let me know if you are ok with this answer because we can close this bug then.
from pcre2.
I suspect that's more in your court - this still feels like incorrect behaviour to me, but I don't think it's my place ๐
And I'm fine with the workaround.
Thanks!
from pcre2.
Regex101 says: https://regex101.com/r/6XKrAV/1
Catastrophic backtracking has been detected and the execution of your expression has been halted. To find out more and what this is, please read the following article: Runaway Regular Expressions
Writing good patterns is important, the engine has limits to help you. E.g. a bubble sort is always much slower than a quick sort, whatever a C compiler does, and this is not the fault of the compiler.
from pcre2.
Related Issues (20)
- Feature Request: two new options for implicit (*SKIP) HOT 9
- Variable-length lookbehind HOT 9
- Inconsistent behaviour for NULL zero length strings HOT 5
- pcre2.exceptions.CompileError: Compilation failed at position 743. Regular expression is too large HOT 2
- Segfault in pcre2_jit_match for MSYS2 and CYGWIN HOT 2
- AddressSanitizer: heap-buffer-overflow HOT 1
- Arm64 crash on JIT call to incorrect address HOT 11
- Large Input (length : 1 Lakh) and pattern has 3999 capture groups, I think code is going into infinite loop or taking so long time HOT 8
- pcre2 incorrectly parses `[.][^.]*$`. HOT 3
- Create a subproject for sljit HOT 2
- For big regex JIT compiler is returning PCRE2_ERROR_NOMEMORY HOT 2
- testinput10 test failure with default newline other than LF HOT 1
- Is there a way to copy `pcre2_code` but using different memory allocation functions? HOT 3
- pcre2_match argument start_offset has no effect HOT 2
- Heap-buffer-overflow on pcre2_compile_8 HOT 1
- segsegv when filling dfa_workspace with random values HOT 2
- PCRE2 doesn't build when acquired through conan HOT 2
- Potential syntax incompatibility with other engines (ex: Javascript, GO, NET or POSIX) by flexible interpretation in curly brackets HOT 3
- heap-buffer-overflow in PHP preg_replace on Mac M1 in Linux HOT 6
- Potential integer overflow issue in DFA matching HOT 6
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.