Skip to content

Commit 8c06891

Browse files
committed
Update docs
1 parent 844361b commit 8c06891

File tree

1 file changed

+29
-13
lines changed

1 file changed

+29
-13
lines changed

README.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,29 @@
22

33
Eloquent Regex brings the simplicity and elegance to regular expressions. Designed for Laravel developers, this package offers a fluent, intuitive interface for building and executing regex patterns in your PHP applications.
44

5+
### Table of Contents
6+
7+
- [Overview](#overview)
8+
- [Key Features](#key-features)
9+
- [Getting Started](#getting-started)
10+
- [Basic Usage](#basic-usage)
11+
- [Including EloquentRegex](#including-eloquentregex)
12+
- [Usage Structure](#usage-structure)
13+
- [Ready-to-Use Patterns](#ready-to-use-patterns)
14+
- [Custom Patterns](#custom-patterns)
15+
- [Creating a Custom Pattern](#creating-a-custom-pattern)
16+
- [Applying Quantifiers](#applying-quantifiers)
17+
- [Optional Elements](#optional-elements)
18+
- [Specifying a Range](#specifying-a-range)
19+
- [One or More](#one-or-more)
20+
- [Zero or More](#zero-or-more)
21+
- [Exact Number](#exact-number)
22+
- [Custom Character Sets and Groups](#custom-character-sets-and-groups)
23+
- [Quantifier Values](#quantifier-values)
24+
525
# Overview
626

7-
### Dreaming of a world where regex doesn't feel like a rocket science? 😄🚀
27+
#### Dreaming of a world where regex doesn't feel like a rocket science? 😄🚀
828

929
Regular expressions (regex) are powerful, no doubt. They're the Swiss Army knife for string manipulation and validation. But let's be honest, they can also be a bit of a headache. The syntax is dense, and a tiny mistake can throw everything off. It's like they're designed to be as intimidating as possible, especially when you're just trying to validate an email address!
1030

@@ -222,7 +242,7 @@ Quantifiers in regular expressions are symbols or sets of symbols that specify h
222242

223243
### Optional Elements
224244

225-
To make an element optional, use '?'. This matches zero or one occurrence of the preceding element.
245+
To make an element optional, use '?'. This matches zero or one occurrence of the preceding element (`dash` in this example).
226246

227247
```php
228248
// Matches a string that may or may not contain a dash
@@ -237,7 +257,7 @@ For specifying a range of occurrences, use a string with two numbers separated b
237257
```php
238258
// Matches a string with 2 to 5 spaces
239259
$result = EloquentRegex::start($yourString)->text()->space('2,5')->digits()->check();
240-
// Result: the "someText 234" would return true, the "someText 234" false
260+
// Result: the "someText 234" would return true, but the "someText 234" false
241261
```
242262

243263
### One or More
@@ -252,7 +272,7 @@ $result = EloquentRegex::start("\\\\")->backslash('1+')->check();
252272

253273
### Zero or More
254274

255-
The '\*' quantifier matches zero or more occurrences of the preceding element.
275+
The '0+' quantifier matches zero or more occurrences of the preceding element.
256276

257277
```php
258278
// Matches strings with zero or more forward slashes
@@ -287,17 +307,15 @@ $regex = EloquentRegex::builder()->start()
287307
### Quantifier values
288308

289309
In [Special characters](https://github.com/MaestroError/eloquent-regex/blob/documentation-and-examples/src/Traits/BuilderPatternTraits/SpecificCharsTrait.php)
290-
and
291-
[Groups](https://github.com/MaestroError/eloquent-regex/blob/documentation-and-examples/src/Traits/BuilderPatternTraits/GroupsTrait.php)Available
292-
nearly all methods allowing quantifiers with values:
310+
and [Groups](https://github.com/MaestroError/eloquent-regex/blob/documentation-and-examples/src/Traits/BuilderPatternTraits/GroupsTrait.php) - nearly all methods allowing quantifiers with values:
293311

294312
- Zero or More = `"zeroOrMore"`, `"0>"`, `"0+"`, `"*"`
295313
- One or More = `"oneOrMore"`, `"1>"`, `"1+"`, `"+"`
296314
- Optional (Zero or One) = `"optional"`, `"?"`, `"|"`
297315
- exact amount = `2`, `"5"`
298316
- range = `"{0,5}"`
299317

300-
Example: `->exact("hello world", false, "1+")`
318+
Example: `->literal("hello world", false, "1+")`
301319

302320
But
303321
[Character Classes](https://github.com/MaestroError/eloquent-regex/blob/documentation-and-examples/src/Traits/BuilderPatternTraits/CharacterClassesTrait.php)
@@ -317,6 +335,8 @@ EloquentRegex::start($yourString)->digits(5);
317335
EloquentRegex::start($yourString)->digitsRange(1, 5); // Matches from 1 to 5 digits
318336
```
319337

338+
---
339+
320340
##### To Do
321341

322342
- Add options for new patterns:
@@ -333,7 +353,7 @@ EloquentRegex::start($yourString)->digitsRange(1, 5); // Matches from 1 to 5 dig
333353
- Regex Flags: Guide on applying regex flags to patterns for specialized matching behavior.
334354
- Grouping and Capturing: How to use groups (capturing and non-capturing) and apply quantifiers to them.
335355
- Add section in docs for "lazy" method
336-
- Add in docs sections:
356+
- Add sections:
337357
- Testing and Debugging
338358
- Credits
339359
- Contributing
@@ -349,7 +369,3 @@ EloquentRegex::start($yourString)->digitsRange(1, 5); // Matches from 1 to 5 dig
349369
- Make patterns controllable from config or provider (?)
350370
- I should be able to make new pattern using BuilderPattern
351371
- I should be able to make add custom pattern to the existing one using BuilderPattern
352-
353-
```
354-
355-
```

0 commit comments

Comments
 (0)