Comments (10)
Right.
https://github.com/monolifed/tiny-regex-c/tree/quantifier
from tiny-regex-c.
Hi @violet701
The quantifier-operator ({number-of-matches}
, {min-matches, max-matches
) is not supported. I think that's the problem you're experiencing.
As a small hack, maybe you can replace \d{15}
with \d+
or \d\d\d\d\d\d\d\d\d\d\d\d\d\d\d
...?
from tiny-regex-c.
Adding the matching function doesn't seem hard
static int matchquantifier(regex_t p, regex_t* pattern, const char* text, int min, int max)
{
max -= min;
while (min > 0 && *text && matchone(p, *text++))
{
min--;
}
if (min > 0)
return 0;
do
{
if (matchpattern(pattern, text))
return 1;
max--;
}
while (max > 0 && *text && matchone(p, *text++));
return 0;
}
But you'd probably need another array to store mins and maxs
from tiny-regex-c.
Hi @monolifed
Maybe you could extract the min/max limits from the pattern before calling the matching function, avoiding the need to add extra variables holding the min/max values?
from tiny-regex-c.
Wow that looks really promising @monolifed :) i will review the code later today / this evening.
I expect i will merge your PR #22 as well :)
from tiny-regex-c.
I have run a few tests on your quantifier-branch, and I really like it so far.
If you make another PR adding the quantifier functionality (or add it to #22), I will merge it.
from tiny-regex-c.
oh, it's GREAT!!!
from tiny-regex-c.
Hey @monolifed - will you make a PR with the quantifier-addition? I think I somehow dropped this on the floor.
I am not sure how to review which additions were made besides the addition of the matchquantifier-function. Maybe you have a better recollection/overview?
from tiny-regex-c.
I don't really remember well
from tiny-regex-c.
😆
I'll try and see if I can get time to clone the branch, pull from master and diff against it. That should do it no? I don't think that branch is any unmergeable changes behind.
from tiny-regex-c.
Related Issues (20)
- matchlen may be wrong HOT 5
- Incorrect results for repeat operators HOT 3
- I ported this to rust HOT 1
- Add Precompiled Regex Code Generator HOT 4
- Python random tests are failing but CI is passing
- regex compilation is making things slower? HOT 1
- support for non-greedy `*?` and `+?`
- Wrong match length? HOT 3
- Error on isdigit, isalpha, isspace with char > 127
- re_matchp succeeds only for the first string compared to a pattern HOT 1
- vcpkg installion windows - length is not changing in return
- support for {n,m},repeat N to M times? HOT 1
- Software vulnerabilities detected during code analysis with ESBMC-WR tool HOT 1
- fix pattern '[1-5-]+' against '123-'
- Do not support {n, m} feature. HOT 1
- Not only does [^blah] not work but the non-inverted [blah] doesn't work either HOT 1
- Cannot match end-of-pattern match
- re. HOT 1
- Match of `\\s*` on empty string reports `pos == -1`, i.e., no match, while it should report `pos == 0` and `matchlength == 0`
- Migrate all test scripts to Python v3 HOT 1
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 tiny-regex-c.