Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.