Comments (6)
This is probably the best place to ask instead of opening a new issue. I must know what tool/algorithm you used to create that convoluted beast of a RegEx! Please don't say you did this by hand :D
from microlight.
wow. thanks!
(sorry, I'm not gonna fix this issue)
from microlight.
- filed as wontfix
from microlight.
@pachacamac yes, that was built by hand :-)
But that's not that complicated as you might assume. First I also started with googling for an algorithm which would do that for me, but then I realized that the principle is simple. Roughly speaking, it makes sence to "factor out" in case if there are four or more words starting with the same letter:
lambda|let|lock|long
l(ambda|et|ock|ong) <-- one byte saved!
If we only have three or less words, there is no sence to factor out:
global|goto|guard
g(lobal|oto|uard) // same length
do|double
d(o|ouble) // even bigger
This was the most typical case for taking a decision. For others, in case of doubt I just compared the length.
from microlight.
Really wonder though if that could be done automatically. Huffman encoding comes to mind but right now I can't think of how to implement it nor if it's worth it, but its kind of interesting :D
EDIT: Almost. Not Huffman tree but https://en.wikipedia.org/wiki/Radix_tree
from microlight.
Keeps being cool!
Thanks for not fixing it :)
from microlight.
Related Issues (9)
- Use in NodeJS? HOT 1
- Support for live highlighting in a contenteditable element HOT 3
- Use options instead hardcoded variables to customize style HOT 1
- Highlight selected keyword HOT 1
- when load jquery 3 firstly, it broke.
- Is there any example to use it with react app? HOT 1
- Microlight won't highlight HTML elements properly at all HOT 1
- Support `<pre><code>` tags. HOT 3
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 microlight.