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 /
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; a guide can be found
under the google/re2 repository on GitHub.
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; a guide can be found
under the google/re2 repository on GitHub.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis document provides reference information for the \u003ccode\u003eCloudStorageRegexFileSet\u003c/code\u003e class within the Google Cloud Data Loss Prevention v2 API for .NET.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCloudStorageRegexFileSet\u003c/code\u003e is used to define a set of files in a Cloud Storage bucket, using regular expressions to include or exclude specific files based on their paths.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eCloudStorageRegexFileSet\u003c/code\u003e class is 4.16.0, and it covers a wide range of previous versions, starting from 2.15.0.\u003c/p\u003e\n"],["\u003cp\u003eFiles are included in the set if they match at least one \u003ccode\u003einclude_regex\u003c/code\u003e and do not match any \u003ccode\u003eexclude_regex\u003c/code\u003e, and if \u003ccode\u003einclude_regex\u003c/code\u003e is empty, all files are matched by default.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBucketName\u003c/code\u003e, \u003ccode\u003eExcludeRegex\u003c/code\u003e, and \u003ccode\u003eIncludeRegex\u003c/code\u003e are core properties to be used to define the file set by using regular expression.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Data Loss Prevention v2 API - Class CloudStorageRegexFileSet (4.19.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.19.0 (latest)](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.18.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.18.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.17.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.17.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.16.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.16.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.15.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.15.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.14.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.14.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.13.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.13.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.12.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.12.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.11.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.11.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.10.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.10.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.9.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.9.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.8.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.8.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.7.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.7.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.6.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.5.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.4.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.3.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.2.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.1.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/4.0.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.5.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.4.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.3.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/3.2.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [2.16.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/2.16.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet)\n- [2.15.0](/dotnet/docs/reference/Google.Cloud.Dlp.V2/2.15.0/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet) \n\n public sealed class CloudStorageRegexFileSet : IMessage\u003cCloudStorageRegexFileSet\u003e, IEquatable\u003cCloudStorageRegexFileSet\u003e, IDeepCloneable\u003cCloudStorageRegexFileSet\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Data Loss Prevention v2 API class CloudStorageRegexFileSet.\n\nMessage representing a set of files in a Cloud Storage bucket. Regular\nexpressions are used to allow fine-grained control over which files in the\nbucket to include.\n\nIncluded files are those that match at least one item in `include_regex` and\ndo not match any items in `exclude_regex`. Note that a file that matches\nitems from both lists will *not* be included. For a match to occur, the\nentire file path (i.e., everything in the url after the bucket name) must\nmatch the regular expression.\n\nFor example, given the input `{bucket_name: \"mybucket\", include_regex:\n[\"directory1/.*\"], exclude_regex:\n[\"directory1/excluded.*\"]}`:\n\n- `gs://mybucket/directory1/myfile` will be included\n- `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches across `/`)\n- `gs://mybucket/directory0/directory1/myfile` will *not* be included (the full path doesn't match any items in `include_regex`)\n- `gs://mybucket/directory1/excludedfile` will *not* be included (the path matches an item in `exclude_regex`)\n\nIf `include_regex` is left empty, it will match all files by default\n(this is equivalent to setting `include_regex: [\".*\"]`).\n\nSome other common use cases:\n\n- `{bucket_name: \"mybucket\", exclude_regex: [\".*\\.pdf\"]}` will include all files in `mybucket` except for .pdf files\n- `{bucket_name: \"mybucket\", include_regex: [\"directory/[^/]+\"]}` will include all files directly under `gs://mybucket/directory/`, without matching across `/` \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CloudStorageRegexFileSet \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[CloudStorageRegexFileSet](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2.CloudStorageRegexFileSet), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CloudStorageRegexFileSet](/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](/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) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Dlp.V2](/dotnet/docs/reference/Google.Cloud.Dlp.V2/latest/Google.Cloud.Dlp.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Dlp.V2.dll\n\nConstructors\n------------\n\n### CloudStorageRegexFileSet()\n\n public CloudStorageRegexFileSet()\n\n### CloudStorageRegexFileSet(CloudStorageRegexFileSet)\n\n public CloudStorageRegexFileSet(CloudStorageRegexFileSet other)\n\nProperties\n----------\n\n### BucketName\n\n public string BucketName { get; set; }\n\nThe name of a Cloud Storage bucket. Required.\n\n### ExcludeRegex\n\n public RepeatedField\u003cstring\u003e ExcludeRegex { get; }\n\nA list of regular expressions matching file paths to exclude. All files in\nthe bucket that match at least one of these regular expressions will be\nexcluded from the scan.\n\nRegular expressions use RE2\n[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\nunder the google/re2 repository on GitHub.\n\n### IncludeRegex\n\n public RepeatedField\u003cstring\u003e IncludeRegex { get; }\n\nA list of regular expressions matching file paths to include. All files in\nthe bucket that match at least one of these regular expressions will be\nincluded in the set of files, except for those that also match an item in\n`exclude_regex`. Leaving this field empty will match all files by default\n(this is equivalent to including `.*` in the list).\n\nRegular expressions use RE2\n[syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\nunder the google/re2 repository on GitHub."]]