# Google Cloud Data Loss Prevention v2 API - Class CloudStorageRegexFileSet (4.26.0)

4.26.0 (latest) 4.25.0 4.24.0 4.23.0 4.22.0 4.21.0 4.20.0 4.19.0 4.18.0 4.17.0 4.16.0 4.15.0 4.14.0 4.13.0 4.12.0 4.11.0 4.10.0 4.9.0 4.8.0 4.7.0 4.6.0 4.5.0 4.4.0 4.3.0 4.2.0 4.1.0 4.0.0 3.5.0 3.4.0 3.3.0 3.2.0 2.16.0 2.15.0

    public sealed class CloudStorageRegexFileSet : IMessage<CloudStorageRegexFileSet>, IEquatable<CloudStorageRegexFileSet>, IDeepCloneable<CloudStorageRegexFileSet>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Data Loss Prevention v2 API 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 `/`

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> CloudStorageRegexFileSet

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CloudStorageRegexFileSet](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CloudStorageRegexFileSet](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[CloudStorageRegexFileSet](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.Dlp.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2)

## Assembly

Google.Cloud.Dlp.V2.dll

## Constructors

### CloudStorageRegexFileSet()

    public CloudStorageRegexFileSet()

### CloudStorageRegexFileSet(CloudStorageRegexFileSet)

    public CloudStorageRegexFileSet(CloudStorageRegexFileSet other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet` |

## Properties

### BucketName

    public string BucketName { get; set; }

The name of a Cloud Storage bucket. Required.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### ExcludeRegex

    public RepeatedField<string> ExcludeRegex { get; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |

### IncludeRegex

    public RepeatedField<string> IncludeRegex { get; }

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.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://learn.microsoft.com/dotnet/api/system.string` |   |