pitrou commented on code in PR #12625:
URL: https://github.com/apache/arrow/pull/12625#discussion_r863955836


##########
cpp/src/arrow/filesystem/path_util.cc:
##########
@@ -287,6 +288,42 @@ bool IsLikelyUri(util::string_view v) {
   return ::arrow::internal::IsValidUriScheme(v.substr(0, pos));
 }
 
+struct Globber::Impl {
+  std::regex pattern_;
+
+  explicit Impl(const std::string& p) : 
pattern_(std::regex(PatternToRegex(p))) {}
+
+  std::string PatternToRegex(const std::string& p) {
+    std::string special_chars_ = "()[]{}+-|^$\\.&~# \t\n\r\v\f";
+    std::string transformed;
+    for (char c : p) {
+      if (c == '*') {
+        if (transformed.back() != '\\')

Review Comment:
   Well, you don't need to assume anything: you can read the documentation ;-)
   https://en.cppreference.com/w/cpp/string/basic_string/back
   
   > Returns reference to the last character in the string. The behavior is 
undefined if empty() == true. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to