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 ininclude_regexand
do not match any items inexclude_regex. Note that a file that matches
items from both lists willnotbe 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/myfilewill be included
gs://mybucket/directory1/directory2/myfilewill be included (.*matches
across/)
gs://mybucket/directory0/directory1/myfilewillnotbe included (the
full path doesn't match any items ininclude_regex)
gs://mybucket/directory1/excludedfilewillnotbe included (the path
matches an item inexclude_regex)
Ifinclude_regexis left empty, it will match all files by default
(this is equivalent to settinginclude_regex: [".*"]).
Some other common use cases:
{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}will include all
files inmybucketexcept for .pdf files
{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}will
include all files directly undergs://mybucket/directory/, without matching
across/
Generated from protobuf messagegoogle.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
array
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 inexclude_regex. Leaving this field empty will match all files by default (this is equivalent to including.*in the list). Regular expressions use RE2syntax; a guide can be found under the google/re2 repository on GitHub.
↳ exclude_regex
array
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 RE2syntax; 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 inexclude_regex. Leaving this field empty will match all files by default
(this is equivalent to including.*in the list).
Regular expressions use RE2syntax; a guide can be found
under the google/re2 repository on GitHub.
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 inexclude_regex. Leaving this field empty will match all files by default
(this is equivalent to including.*in the list).
Regular expressions use RE2syntax; 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 RE2syntax; a guide can be found
under the google/re2 repository on GitHub.
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 RE2syntax; 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,["# Data Loss Prevention V2 Client - Class CloudStorageRegexFileSet (2.6.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.6.1 (latest)](/php/docs/reference/cloud-dlp/latest/V2.CloudStorageRegexFileSet)\n- [2.6.0](/php/docs/reference/cloud-dlp/2.6.0/V2.CloudStorageRegexFileSet)\n- [2.4.1](/php/docs/reference/cloud-dlp/2.4.1/V2.CloudStorageRegexFileSet)\n- [2.3.0](/php/docs/reference/cloud-dlp/2.3.0/V2.CloudStorageRegexFileSet)\n- [2.2.3](/php/docs/reference/cloud-dlp/2.2.3/V2.CloudStorageRegexFileSet)\n- [2.1.0](/php/docs/reference/cloud-dlp/2.1.0/V2.CloudStorageRegexFileSet)\n- [2.0.0](/php/docs/reference/cloud-dlp/2.0.0/V2.CloudStorageRegexFileSet)\n- [1.19.0](/php/docs/reference/cloud-dlp/1.19.0/V2.CloudStorageRegexFileSet)\n- [1.18.0](/php/docs/reference/cloud-dlp/1.18.0/V2.CloudStorageRegexFileSet)\n- [1.17.0](/php/docs/reference/cloud-dlp/1.17.0/V2.CloudStorageRegexFileSet)\n- [1.16.0](/php/docs/reference/cloud-dlp/1.16.0/V2.CloudStorageRegexFileSet)\n- [1.15.1](/php/docs/reference/cloud-dlp/1.15.1/V2.CloudStorageRegexFileSet)\n- [1.14.0](/php/docs/reference/cloud-dlp/1.14.0/V2.CloudStorageRegexFileSet)\n- [1.13.2](/php/docs/reference/cloud-dlp/1.13.2/V2.CloudStorageRegexFileSet)\n- [1.12.0](/php/docs/reference/cloud-dlp/1.12.0/V2.CloudStorageRegexFileSet)\n- [1.11.0](/php/docs/reference/cloud-dlp/1.11.0/V2.CloudStorageRegexFileSet)\n- [1.10.2](/php/docs/reference/cloud-dlp/1.10.2/V2.CloudStorageRegexFileSet)\n- [1.9.0](/php/docs/reference/cloud-dlp/1.9.0/V2.CloudStorageRegexFileSet)\n- [1.8.6](/php/docs/reference/cloud-dlp/1.8.6/V2.CloudStorageRegexFileSet) \nReference documentation and code samples for the Data Loss Prevention V2 Client 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.\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`) 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:\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\nGenerated from protobuf message `google.privacy.dlp.v2.CloudStorageRegexFileSet`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Dlp \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getBucketName\n\nThe name of a Cloud Storage bucket. Required.\n\n### setBucketName\n\nThe name of a Cloud Storage bucket. Required.\n\n### getIncludeRegex\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.\n\n### setIncludeRegex\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.\n\n### getExcludeRegex\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### setExcludeRegex\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."]]