Skip to content

Commit f640d32

Browse files
committed
docs: update README with Scarf telemetry and v1.5.1 features
1 parent b3dd454 commit f640d32

1 file changed

Lines changed: 35 additions & 32 deletions

File tree

README.md

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Sift
2+
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=e931dfa9-02e9-406d-bde7-56f9e0000464" alt=""/>
3+
24
[![sift-core](https://img.shields.io/maven-central/v/com.mirkoddd/sift-core?label=sift-core)](https://central.sonatype.com/artifact/com.mirkoddd/sift-core)
35
[![sift-annotations](https://img.shields.io/maven-central/v/com.mirkoddd/sift-annotations?label=sift-annotations)](https://central.sonatype.com/artifact/com.mirkoddd/sift-annotations)
46
[![Java 8+](https://img.shields.io/badge/Java-8+-blue.svg)](https://adoptium.net/) [![Tests](https://github.com/mirkoddd/Sift/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/mirkoddd/Sift/actions)
@@ -27,22 +29,22 @@ Add Sift to your project dependencies:
2729
<version>latest-version</version>
2830
</dependency>
2931
<dependency>
30-
<groupId>com.mirkoddd</groupId>
31-
<artifactId>sift-annotations</artifactId>
32-
<version>latest-version</version>
32+
<groupId>com.mirkoddd</groupId>
33+
<artifactId>sift-annotations</artifactId>
34+
<version>latest-version</version>
3335
</dependency>
3436
```
3537

3638
**Gradle:**
3739

3840
```Groovy
39-
// Replace <latest-version> with the version shown in the Maven Central badge above
40-
41-
// Core Engine: Fluent API for Regex generation (Zero external dependencies)
42-
implementation 'com.mirkoddd:sift-core:<latest-version>'
43-
44-
// Optional: Integration with Jakarta Validation / Hibernate Validator
45-
implementation 'com.mirkoddd:sift-annotations:<latest-version>'
41+
// Replace <latest-version> with the version shown in the Maven Central badge above
42+
43+
// Core Engine: Fluent API for Regex generation (Zero external dependencies)
44+
implementation 'com.mirkoddd:sift-core:<latest-version>'
45+
46+
// Optional: Integration with Jakarta Validation / Hibernate Validator
47+
implementation 'com.mirkoddd:sift-annotations:<latest-version>'
4648
```
4749
## Compatibility
4850

@@ -61,6 +63,7 @@ However, the internal codebase and test suite utilize modern **Java 17** feature
6163
* **High Performance & Zero Allocation:** Internally optimized with pre-computed O(1) cache lookups and careful memory management. Sift avoids unnecessary object allocations, ensuring lightning-fast regex generation even in tight loops.
6264
* **Zero Dependencies:** The `sift-core` engine is pure Java. It doesn't pull in any bloated transitive dependencies, keeping your final artifact size incredibly small.
6365
* **Android & Enterprise Ready:** Compiled to Java 8 bytecode for maximum compatibility. It ships with built-in Proguard/R8 rules, guaranteeing flawless integration out-of-the-box for both Android applications and modern/legacy Spring Boot servers.
66+
* **Global Null-Safety & Fail-Fast:** Every method in the DSL is protected by strict null-checks. Sift fails immediately with clear feedback if invalid parameters are passed, preventing inconsistent regex states in production.
6467
* **100% Test Coverage:** Rock-solid reliability tested against edge cases, negations, and complex nested group scenarios.
6568

6669

@@ -72,20 +75,20 @@ Forget about counting backslashes or memorizing obscure symbols. Sift guides you
7275

7376
```Java
7477

75-
import static com.mirkoddd.sift.core.Sift.fromStart;
76-
77-
// Goal: Match an international username securely
78-
String regex = fromStart()
78+
import static com.mirkoddd.sift.core.Sift.fromStart;
79+
80+
// Goal: Match an international username securely
81+
String regex = fromStart()
7982
.exactly(1).unicodeLettersUppercaseOnly() // Must start with an uppercase letter
8083
.then()
8184
.between(3, 15).unicodeWordCharacters().withoutBacktracking() // Secure against ReDoS
8285
.then()
8386
.optional().digits() // May end with an ASCII number
8487
.andNothingElse()
85-
.shake();
86-
87-
// Result: ^\p{Lu}[\p{L}\p{Nd}_]{3,15}+[0-9]?$
88-
88+
.shake();
89+
90+
// Result: ^\p{Lu}[\p{L}\p{Nd}_]{3,15}+[0-9]?$
91+
8992
```
9093

9194
# 2. Seamless Jakarta Validation
@@ -94,29 +97,29 @@ Stop duplicating regex logic in your DTOs. Centralize your rules and reuse them
9497

9598
```Java
9699

97-
// 1. Define your reusable rule (e.g., matching "PROMO123")
98-
public class PromoCodeRule implements SiftRegexProvider {
99-
100-
public String getRegex() {
101-
return Sift.fromStart()
100+
// 1. Define your reusable rule (e.g., matching "PROMO123")
101+
public class PromoCodeRule implements SiftRegexProvider {
102+
103+
public String getRegex() {
104+
return Sift.fromStart()
102105
.atLeast(4).letters()
103106
.then()
104107
.exactly(3).digits()
105108
.andNothingElse()
106109
.shake();
110+
}
107111
}
108-
}
109-
110-
// 2. Apply it to your models with Type-Safe Flags
111-
public record ApplyPromoRequest(
112+
113+
// 2. Apply it to your models with Type-Safe Flags
114+
public record ApplyPromoRequest(
112115
@SiftMatch(
113-
value = PromoCodeRule.class,
114-
flags = {SiftMatchFlag.CASE_INSENSITIVE}, // Allows "promo123" to pass
115-
message = "Invalid promo code format"
116+
value = PromoCodeRule.class,
117+
flags = {SiftMatchFlag.CASE_INSENSITIVE}, // Allows "promo123" to pass
118+
message = "Invalid promo code format"
116119
)
117120
String promoCode
118-
) {}
119-
121+
) {}
122+
120123
```
121124

122125
*Sift compiles the Pattern only once during initialization, ensuring zero performance overhead during validation.*

0 commit comments

Comments
 (0)