Skip to main content
indentation
Source Link
Ardent Coder
  • 4.1k
  • 9
  • 35
  • 62

With C++11 you can use std::regex like so:

 #include <regex>  ...  std::string string("hello $name");  string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

 #include <regex>  ...  std::string string("hello $name");  string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

#include <regex> ... std::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

added include header
Source Link
Mark Lakata
  • 21.1k
  • 6
  • 114
  • 128

With C++11 you can use std::regex like so:

 #include <regex> ... std::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

 std::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

 #include <regex> ... std::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

added 4 characters in body
Source Link
Tom
  • 2.7k
  • 1
  • 19
  • 17

With C++11 you can use std::regex like so:

 QStringstd::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

 QString string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

With C++11 you can use std::regex like so:

 std::string string("hello $name"); string = std::regex_replace(string, std::regex("\\$name"), "Somename"); 

The double backslash is required for escaping an escape character.

deleted 45 characters in body
Source Link
BartoszKP
  • 36k
  • 15
  • 109
  • 135
Loading
Source Link
Tom
  • 2.7k
  • 1
  • 19
  • 17
Loading