Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rudashi committed Apr 13, 2024
1 parent 708822c commit 8bc9af0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
1 change: 1 addition & 0 deletions docs/advance.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ previous-link: usage/patterns

## Returning results

- [`check`](advance/returning-results#check)
- [`get`](advance/returning-results#get)

## Negation
Expand Down
14 changes: 13 additions & 1 deletion docs/advance/returning-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ previous-link: advance/suffix-anchors

# Returning results

#### `get`
### `check`

The `check` method checks whether the pattern matches the context.

```php
use Rudashi\Regex;

$pattern = Regex::for('hannah')->exactly('a')->check();

// true
```

### `get`

The `get` method returns the entire pattern as a string.

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ You can start creating your regex by using `Regex::build()`. The `build()` metho
## Other methods

- [`capture`](usage/others#capture)
- [`or`](usage/others#or)
- [`oneOf`](usage/others#oneof)
- [`or`](usage/others#or)

## Patterns methods
24 changes: 12 additions & 12 deletions docs/usage/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@ $pattern = Regex::build()->capture(
// /(\.[a-zA-Z])/
```

### `or`
### `oneOf`

The `or` method alternatively matches the pattern before and after using the method.
The `oneOf` method alternatively matches any of the given characters.

```php
use Rudashi\Regex;

$pattern = Regex::build()->exactly('a')->or()->exactly('b');
$pattern = Regex::build()->oneOf('a', 'b', '.');

// /a|b/
// /a|b|\./
```

Alternatively, you can use the `or` property, which works identically.
### `or`

The `or` method alternatively matches the pattern before and after using the method.

```php
use Rudashi\Regex;

$pattern = Regex::build()->exactly('a')->or->exactly('b');
$pattern = Regex::build()->exactly('a')->or()->exactly('b');

// /a|b/
```

### `oneOf`

The `oneOf` method alternatively matches any of the given characters.
Alternatively, you can use the `or` property, which works identically.

```php
use Rudashi\Regex;

$pattern = Regex::build()->oneOf('a', 'b', '.');
$pattern = Regex::build()->exactly('a')->or->exactly('b');

// /a|b|\./
```
// /a|b/
```

0 comments on commit 8bc9af0

Please sign in to comment.