Reference documentation and code samples for the Cloud Data Loss Prevention (DLP) V2 API class Google::Cloud::Dlp::V2::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 /
Inherits
Object
Extended By
Google::Protobuf::MessageExts::ClassMethods
Includes
Google::Protobuf::MessageExts
Methods
#bucket_name
defbucket_name()->::String
Returns
(::String) — The name of a Cloud Storage bucket. Required.
#bucket_name=
defbucket_name=(value)->::String
Parameter
value (::String) — The name of a Cloud Storage bucket. Required.
Returns
(::String) — The name of a Cloud Storage bucket. Required.
#exclude_regex
defexclude_regex()->::Array<::String>
Returns
(::Array<::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; a guide can be found
under the google/re2 repository on GitHub.
#exclude_regex=
defexclude_regex=(value)->::Array<::String>
Parameter
value (::Array<::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; a guide can be found
under the google/re2 repository on GitHub.
Returns
(::Array<::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; a guide can be found
under the google/re2 repository on GitHub.
#include_regex
definclude_regex()->::Array<::String>
Returns
(::Array<::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; a guide can be found
under the google/re2 repository on GitHub.
#include_regex=
definclude_regex=(value)->::Array<::String>
Parameter
value (::Array<::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; a guide can be found
under the google/re2 repository on GitHub.
Returns
(::Array<::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; 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"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Data Loss Prevention (DLP) V2 API - Class Google::Cloud::Dlp::V2::CloudStorageRegexFileSet (v1.12.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.12.1 (latest)](/ruby/docs/reference/google-cloud-dlp-v2/latest/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.12.0](/ruby/docs/reference/google-cloud-dlp-v2/1.12.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.11.0](/ruby/docs/reference/google-cloud-dlp-v2/1.11.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.10.0](/ruby/docs/reference/google-cloud-dlp-v2/1.10.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.9.1](/ruby/docs/reference/google-cloud-dlp-v2/1.9.1/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.8.0](/ruby/docs/reference/google-cloud-dlp-v2/1.8.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.7.0](/ruby/docs/reference/google-cloud-dlp-v2/1.7.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.6.0](/ruby/docs/reference/google-cloud-dlp-v2/1.6.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.5.0](/ruby/docs/reference/google-cloud-dlp-v2/1.5.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.4.0](/ruby/docs/reference/google-cloud-dlp-v2/1.4.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.3.1](/ruby/docs/reference/google-cloud-dlp-v2/1.3.1/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.2.0](/ruby/docs/reference/google-cloud-dlp-v2/1.2.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.1.0](/ruby/docs/reference/google-cloud-dlp-v2/1.1.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [1.0.0](/ruby/docs/reference/google-cloud-dlp-v2/1.0.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.24.0](/ruby/docs/reference/google-cloud-dlp-v2/0.24.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.23.0](/ruby/docs/reference/google-cloud-dlp-v2/0.23.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.22.0](/ruby/docs/reference/google-cloud-dlp-v2/0.22.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.21.0](/ruby/docs/reference/google-cloud-dlp-v2/0.21.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.20.2](/ruby/docs/reference/google-cloud-dlp-v2/0.20.2/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.19.0](/ruby/docs/reference/google-cloud-dlp-v2/0.19.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.18.0](/ruby/docs/reference/google-cloud-dlp-v2/0.18.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.17.0](/ruby/docs/reference/google-cloud-dlp-v2/0.17.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.16.0](/ruby/docs/reference/google-cloud-dlp-v2/0.16.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.15.0](/ruby/docs/reference/google-cloud-dlp-v2/0.15.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.14.0](/ruby/docs/reference/google-cloud-dlp-v2/0.14.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.13.1](/ruby/docs/reference/google-cloud-dlp-v2/0.13.1/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.12.0](/ruby/docs/reference/google-cloud-dlp-v2/0.12.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.11.0](/ruby/docs/reference/google-cloud-dlp-v2/0.11.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.10.0](/ruby/docs/reference/google-cloud-dlp-v2/0.10.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.9.0](/ruby/docs/reference/google-cloud-dlp-v2/0.9.0/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet)\n- [0.8.1](/ruby/docs/reference/google-cloud-dlp-v2/0.8.1/Google-Cloud-Dlp-V2-CloudStorageRegexFileSet) \nReference documentation and code samples for the Cloud Data Loss Prevention (DLP) V2 API class Google::Cloud::Dlp::V2::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\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #bucket_name\n\n def bucket_name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The name of a Cloud Storage bucket. Required.\n\n### #bucket_name=\n\n def bucket_name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The name of a Cloud Storage bucket. Required. \n**Returns**\n\n- (::String) --- The name of a Cloud Storage bucket. Required.\n\n### #exclude_regex\n\n def exclude_regex() -\u003e ::Array\u003c::String\u003e\n\n**Returns**\n\n- (::Array\\\u003c::String\\\u003e) --- 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.\n\n Regular expressions use RE2\n [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\n under the google/re2 repository on GitHub.\n\n### #exclude_regex=\n\n def exclude_regex=(value) -\u003e ::Array\u003c::String\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c::String\\\u003e) --- 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.\n\n\n Regular 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**Returns**\n\n- (::Array\\\u003c::String\\\u003e) --- 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.\n\n Regular expressions use RE2\n [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\n under the google/re2 repository on GitHub.\n\n### #include_regex\n\n def include_regex() -\u003e ::Array\u003c::String\u003e\n\n**Returns**\n\n- (::Array\\\u003c::String\\\u003e) --- 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).\n\n\n Regular expressions use RE2\n [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\n under the google/re2 repository on GitHub.\n\n### #include_regex=\n\n def include_regex=(value) -\u003e ::Array\u003c::String\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c::String\\\u003e) --- 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).\n\n\n Regular 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**Returns**\n\n- (::Array\\\u003c::String\\\u003e) --- 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).\n\n\n Regular expressions use RE2\n [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found\n under the google/re2 repository on GitHub."]]