brettw | d97eede | 2015-07-06 22:09:00 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BASE_STRINGS_PATTERN_H_ |
| 6 | #define BASE_STRINGS_PATTERN_H_ |
| 7 | |
| 8 | #include "base/base_export.h" |
| 9 | #include "base/strings/string_piece.h" |
| 10 | |
| 11 | namespace base { |
| 12 | |
Bernhard Bauer | de43210 | 2018-01-22 14:13:23 | [diff] [blame] | 13 | // Returns true if the |string| passed in matches the |pattern|. The pattern |
| 14 | // string can contain wildcards like * and ?. |
brettw | d97eede | 2015-07-06 22:09:00 | [diff] [blame] | 15 | // |
Bernhard Bauer | de43210 | 2018-01-22 14:13:23 | [diff] [blame] | 16 | // The backslash character (\) is an escape character for * and ?. |
brettw | d97eede | 2015-07-06 22:09:00 | [diff] [blame] | 17 | // ? matches 0 or 1 character, while * matches 0 or more characters. |
Reilly Grant | 39aecc3 | 2018-01-04 00:52:52 | [diff] [blame] | 18 | BASE_EXPORT bool MatchPattern(StringPiece string, StringPiece pattern); |
| 19 | BASE_EXPORT bool MatchPattern(StringPiece16 string, StringPiece16 pattern); |
brettw | d97eede | 2015-07-06 22:09:00 | [diff] [blame] | 20 | |
| 21 | } // namespace base |
| 22 | |
| 23 | #endif // BASE_STRINGS_PATTERN_H_ |