Comments (3)
I don't even know if it supports nested repeat operators in the first place, so I'll refrain from writing a PR.
But if you want to match the Python result, you would have something like this:
{ OK, "a?", "", (char*) 0 },
{ OK, "a?", "a", (char*) 0 },
{ OK, "a*", "", (char*) 0 },
{ OK, "a??", "a", (char*) 0 },
{ OK, "a?*", "a", (char*) 0 },
{ OK, "a?+", "a", (char*) 0 },
{ OK, "a*?", "a", (char*) 0 },
{ OK, "a**", "a", (char*) 1 },
{ OK, "a*+", "a", (char*) 1 },
{ OK, "a+?", "a", (char*) 0 },
{ OK, "a+*", "a", (char*) 1 },
{ OK, "a++", "a", (char*) 1 },
The Python code I tested:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
# (1)
print(re.match(r'a??', ""))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'a??', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'a*', ""))
#=> <re.Match object; span=(0, 0), match=''>
# (2)
print(re.match(r'(?:a??)??', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'(?:a??)*', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'(?:a??)+', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'(?:a*)??', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'(?:a*)*', "a"))
#=> <re.Match object; span=(0, 1), match='a'>
print(re.match(r'(?:a*)+', "a"))
#=> <re.Match object; span=(0, 1), match='a'>
print(re.match(r'(?:a+)??', "a"))
#=> <re.Match object; span=(0, 0), match=''>
print(re.match(r'(?:a+)*', "a"))
#=> <re.Match object; span=(0, 1), match='a'>
print(re.match(r'(?:a+)+', "a"))
#=> <re.Match object; span=(0, 1), match='a'>
from tiny-regex-c.
Hi @kkos and thanks for the notice π
Could you please provide some code so I can be certain what cases we are talking about.
Could you perhaps make a PR editing some of https://github.com/kokke/tiny-regex-c/blob/master/tests/test1.c to showcase exactly the cases you're talking about in 1) 2) ?
That would help me understand your issue :)
from tiny-regex-c.
Hi @kkos and thanks for helping me understand the issue π
I donβt think the nested operators are supported easily, but I will have a look and get back to you
from tiny-regex-c.
Related Issues (20)
- matchlen may be wrong HOT 5
- 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.