Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
hu.webarticum.strex:strex
Advanced tools
Strex - Generate sorted string list from a regular expression
Generate a sorted string list from a regular expression.
Strex
is a java library for generating an alphabetically sorted lazy list of
all the strings that match a given fixed-length regular expression.
Gradle projects:
dependencies {
implementation "hu.webarticum.strex:strex:${strexVersion}"
}
Maven projects:
<dependency>
<groupId>hu.webarticum.strex</groupId>
<artifactId>strex</artifactId>
<version>${strexVersion}</version>
</dependency>
Here is a little demonstration of the key features:
Strex identifiers = Strex.compile("PID:\\d{3}\\-[a-f]{5}\\-[xrbc]{3}");
System.out.println(identifiers.size()); // 497664000 ( = 10^3 × 1 × 6^5 × 1 × 4^3 )
System.out.println(identifiers.get(0)); // PID:000-aaaaa-bbb
System.out.println(identifiers.get(497663999)); // PID:999-fffff-xxx
System.out.println(identifiers.indexOf("PID:354-fedab-xbb")); // 176650096
Currently, a limited subset of regular expression features is supported:
a
)\t
, \.
)[a-f\d]
)[^\da-fA-F]
)\s
, \S
, \w
, \W
, \d
, \D
).
), generates a printable ASCII character{3}
)^
and $
anchorsű{3}[a-záé]
)In the future, it's planned to extend this functionality to support dynamic-length patterns, but this requires a completely new, much more complex engine. This is a low-priority task.
There are many regex-based random string generators. Strex's main goal is different. It provides the full list of matching strings alphabetically sorted (even if the trivial tree traversal would not give an alphabetical result). This list can be very large, so simply sorting is not an option.
HoloDB uses Strex for generating random strings by a regex. To achieve this, it selects random indices (in an invertible way) and provides the associated strings for these. Because we can execute an efficient search in this virtual list, such table columns can be indexed.
FAQs
Unknown package
We found that hu.webarticum.strex:strex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.