Skip to content

Commit 0ae2054

Browse files
committed
Fixes in docs
1 parent c33e1a3 commit 0ae2054

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -907,15 +907,15 @@ In this example, we precisely match "alt=" using the `exact` method. We then cre
907907

908908
The `orPattern` method also accepts a quantifier as its **second argument** (after callback), applying the same [quantifier logic](#quantifier-values) as elsewhere in EloquentRegex. This feature adds another layer of flexibility, allowing you to specify how many times either pattern should be present.
909909

910-
## Raw Methods 🧩
910+
## Raw Methods🧩
911911

912912
When working with regular expressions, there are times you'll need to insert a segment of raw regex directly into your pattern. This might be due to the complexity of the pattern or simply because you're integrating an existing regex snippet. EloquentRegex accommodates this need with specific methods designed to seamlessly integrate raw regex patterns into your larger expressions.
913913

914914
#### Adding Raw Regex Patterns
915915

916916
The `addRawRegex` method allows you to insert any raw regex directly into your pattern. This is particularly useful for incorporating standard regex snippets without modification.
917917

918-
**Example: Matching a Social Security Number (SSN)**
918+
**_Example: Matching a Social Security Number (SSN)_**
919919

920920
```php
921921
// Directly adds a raw regex pattern for an SSN
@@ -931,7 +931,7 @@ This method is straightforward and ensures that your EloquentRegex pattern can a
931931

932932
Sometimes, you may want to include a raw regex snippet as part of a larger pattern without capturing its match. The `addRawNonCapturingGroup` method wraps the provided raw regex in a non-capturing group, allowing it to participate in the match without affecting the captured groups.
933933

934-
**Example: Adding Digits Followed by a Specific Letter**
934+
**_Example: Adding Digits Followed by a Specific Letter_**
935935

936936
```php
937937
// Wraps digits in a non-capturing group and expects an 'A' immediately after
@@ -949,7 +949,8 @@ In the world of regular expressions, greediness refers to the tendency of quanti
949949

950950
The `lazy()` method modifies the behavior of quantifiers that follow it in the pattern, making them match as few characters as possible. This is particularly useful when you want to extract specific segments from a larger block of text without capturing unnecessary parts.
951951

952-
**Example: Extracting "Secret Coded" Messages from Text**
952+
**_Example: Extracting "Secret Coded" Messages from Text_**
953+
953954
Consider a situation where you need to extract coded messages enclosed in curly braces and preceded by a specific keyword within a larger text. Using the greedy approach might lead to capturing more text than intended, including text between messages. The `lazy()` method ensures that only the content directly within the braces, following the keyword, is matched.
954955

955956
```php
@@ -964,8 +965,7 @@ $matches = EloquentRegex::source($text)
964965
})
965966
->get();
966967

967-
// Expected to extract ['message one', 'another hidden text'] as separate matches
968-
968+
// Extracts ['message one', 'another hidden text'] as separate matches
969969
```
970970

971971
In this example, without the `lazy()` method, the pattern might greedily match from the first `{secret: ` to the last `}`, including everything in between as a single match (`message one} more text {secret: another hidden text`). By applying `lazy()`, the pattern instead matches the smallest possible string that satisfies the pattern within each set of curly braces, effectively separating the messages.

0 commit comments

Comments
 (0)