#include <regex>
std::regex numberPrefixRegex(R"(^\d)"); // Regex to match strings starting with a number
std::string str; 
// define folderName
if (std::regex_search(str, numberPrefixRegex)) 
{
    std::cout << str << std::endl;
}

fmt

fmt is an open-source formatting library for C++ that provides a fast and type-safe alternative to the standard library’s printf and std::stringstream formatting functions. It allows developers to construct strings with embedded variable values using a modern and readable syntax.

#include <fmt/core.h>

int main() {
  int num = 42;
  std::string name = "Alice";

  // Format string with placeholders
  std::string result = fmt::format("Hello, {}! Your number is {}.", name, num);

  // Print to console
  fmt::print("{}\n", result);

  return 0;
}

exception

All STL function without noexcept can throw an exception.