# Data Loss Prevention V2 Client - Class CloudStorageRegexFileSet (2.13.0)

2.13.0 (latest) 2.12.0 2.11.0 2.10.0 2.9.2 2.8.1 2.7.0 2.6.1 2.4.1 2.3.0 2.2.3 2.1.0 2.0.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.1 1.14.0 1.13.2 1.12.0 1.11.0 1.10.2 1.9.0 1.8.6 Reference documentation and code samples for the Data Loss Prevention V2 Client class CloudStorageRegexFileSet.

Message representing a set of files in a Cloud Storage bucket. Regular
expressions are used to allow fine-grained control over which files in the
bucket to include.

Included files are those that match at least one item in `include_regex` and
do not match any items in `exclude_regex`. Note that a file that matches
items from both lists will *not* be included. For a match to occur, the
entire file path (i.e., everything in the url after the bucket name) must
match the regular expression.
For example, given the input `{bucket_name: "mybucket", include_regex:
["directory1/.*"], exclude_regex:
["directory1/excluded.*"]}`:

- `gs://mybucket/directory1/myfile` will be included
- `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches across `/`)
- `gs://mybucket/directory0/directory1/myfile` will *not* be included (the full path doesn't match any items in `include_regex`)
- `gs://mybucket/directory1/excludedfile` will *not* be included (the path matches an item in `exclude_regex`) If `include_regex` is left empty, it will match all files by default (this is equivalent to setting `include_regex: [".*"]`). Some other common use cases:
- `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all files in `mybucket` except for .pdf files
- `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will include all files directly under `gs://mybucket/directory/`, without matching across `/`

Generated from protobuf message `google.privacy.dlp.v2.CloudStorageRegexFileSet`

## Namespace

Google \\ Cloud \\ Dlp \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ bucket_name` | `string` The name of a Cloud Storage bucket. Required. |
| `↳ include_regex` | `string[]` A list of regular expressions matching file paths to include. All files in the bucket that match at least one of these regular expressions will be included in the set of files, except for those that also match an item in `exclude_regex`. Leaving this field empty will match all files by default (this is equivalent to including `.*` in the list). Regular expressions use RE2 [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found under the google/re2 repository on GitHub. |
| `↳ exclude_regex` | `string[]` A list of regular expressions matching file paths to exclude. All files in the bucket that match at least one of these regular expressions will be excluded from the scan. Regular expressions use RE2 [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found under the google/re2 repository on GitHub. |

### getBucketName

The name of a Cloud Storage bucket. Required.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBucketName

The name of a Cloud Storage bucket. Required.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIncludeRegex

A list of regular expressions matching file paths to include. All files in
the bucket that match at least one of these regular expressions will be
included in the set of files, except for those that also match an item in
`exclude_regex`. Leaving this field empty will match all files by default
(this is equivalent to including `.*` in the list).

Regular expressions use RE2
[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
under the google/re2 repository on GitHub.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setIncludeRegex

A list of regular expressions matching file paths to include. All files in
the bucket that match at least one of these regular expressions will be
included in the set of files, except for those that also match an item in
`exclude_regex`. Leaving this field empty will match all files by default
(this is equivalent to including `.*` in the list).

Regular expressions use RE2
[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
under the google/re2 repository on GitHub.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExcludeRegex

A list of regular expressions matching file paths to exclude. All files in
the bucket that match at least one of these regular expressions will be
excluded from the scan.

Regular expressions use RE2
[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
under the google/re2 repository on GitHub.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setExcludeRegex

A list of regular expressions matching file paths to exclude. All files in
the bucket that match at least one of these regular expressions will be
excluded from the scan.

Regular expressions use RE2
[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
under the google/re2 repository on GitHub.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |