Implements a regular expression based string scrubber.  
 More...
#include <str.h>
|  | 
|  | StringSanitizer (const std::string &char_set, const std::string &char_replacement) | 
|  | Constructor. 
 | 
| std::string | scrub (const std::string &original) | 
|  | Returns a scrubbed copy of a given string. 
 | 
|  | 
| static const uint32_t | MAX_DATA_SIZE = 4096 | 
|  | The maximum size for regex parameters. 
 | 
Implements a regular expression based string scrubber. 
Definition at line 222 of file str.h.
◆ StringSanitizer()
      
        
          | isc::util::str::StringSanitizer::StringSanitizer | ( | const std::string & | char_set, | 
        
          |  |  | const std::string & | char_replacement ) | 
      
 
Constructor. 
Compiles the given character set into a regular expression, and retains the given character replacement. Thereafter, the instance may be used to scrub an arbitrary number of strings.
- Parameters
- 
  
    | char_set | string containing a regular expression (POSIX extended syntax) that describes the characters to replace. If you wanted to sanitize hostnames for example, you could specify the inversion of valid characters "[^A-Za-z0-9_-]". |  | char_replacement | string of one or more characters to use as the replacement for invalid characters. |  
 
- Exceptions
- 
  
    | BadValue | if given an invalid regular expression. |  
 
Definition at line 300 of file str.cc.
 
 
◆ scrub()
      
        
          | string isc::util::str::StringSanitizer::scrub | ( | const std::string & | original | ) |  | 
      
 
Returns a scrubbed copy of a given string. 
Replaces all occurrences of characters described by the regular expression with the character replacement.
- Parameters
- 
  
    | original | The string to be scrubbed. |  
 
- Exceptions
- 
  
  
Definition at line 305 of file str.cc.
 
 
◆ MAX_DATA_SIZE
  
  | 
        
          | const uint32_t isc::util::str::StringSanitizer::MAX_DATA_SIZE = 4096 |  | static | 
 
 
The documentation for this class was generated from the following files: