Comments (4)
So it would be possible to re-structure that regex to make it genuinely regular - and therefore leverage this gem - but it's up to you whether you'd like to restructure it...
This:
(?!0{2})[0-9]{2}
Could be written as:
([0-9][1-9]|[1-9][0-9])
And this:
[TV] ((?<=[T])[X-Z]|(?<=[V])[A-HJ-NPR-Z])
(Won't actually work as you expect, since there's an extra space, but) could be written as:
(T[X-Z]|V[A-HJ-NPR-Z])
...and voila, the regex is regular!
Final result:
/^([0-9][1-9]|[1-9][0-9]) (T[X-Z]|V[A-HJ-NPR-Z])[1-9][A-HJ-NPR-Z]$/.random_example
# => "50 VV6R"
Magic 😄
from regexp-examples.
Hi @anderstroker. It's hard to give advice without seeing a concrete example of your use case. Could you share it?
As I've stated in the README, and explained in more detail in a blog post, "irregular" aspects of regex (such as lookarounds) cannot be supported by this library's algorithm.
Perhaps there is a different way to construct the regex, without lookarounds; or perhaps this library isn't a good fit for your problem.
from regexp-examples.
Oh shure, let me show you, I am building a project that through the license plates validate to which entity they belong, type of vehicle, and other things, I use the gem to give me all the combinations of the regex, I built an example for trailers.
(?!0{2}) this ignore 00,just 01 to 99
[TV] ((?<=[T])[X-Z]|(?<=[V])[A-HJ-NPR-Z]) this depending behing character
^(?!0{2})[0-9]{2} [TV] ((?<=[T])[X-Z]|(?<=[V])[A-HJ-NPR-Z])[1-9][A-HJ-NPR-Z]$
from regexp-examples.
Thank you so much, my friend... I will try
from regexp-examples.
Related Issues (17)
- Missing named properties HOT 2
- Empty regexp examples HOT 2
- Allow the use of empty look-arounds
- Randomness regression? HOT 2
- Enhancements to absent operator examples
- Support for conditional capture groups
- Parsing of nested repeat operators
- Predictable behaviour of `max_examples_limit` option
- Support for use without class extension
- enhancement: negative examples? HOT 2
- [bug] Cannot generate examples for /__.__/ HOT 6
- use regexp_parser? HOT 6
- [\p{Nd}] — unicode categories in character classes
- negative unicode property via \P is not supported HOT 2
- Can a reverse abilty be made? HOT 2
- symlink unimplemented when installing HOT 4
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 regexp-examples.