Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

C++11 Regex Example

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 4.35 sec, absolute running time: 0.07 sec, cpu time: 0.02 sec, memory peak: 3 Mb, absolute service time: 4,43 sec 
fork mode |  history
Error(s):
source_file.cpp:19: ; std::regex_match("3423", numRegex) = true
source_file.cpp:20: ; std::regex_match("AAB786", numRegex) = false
source_file.cpp:21: ; std::regex_match("  9745", numRegex) = false
source_file.cpp:22: ; std::regex_match(" 634 ", numRegex) = false
source_file.cpp:27: ; std::regex_search("3423", variable) = false
source_file.cpp:28: ; std::regex_search("dot.com\\ -buble hello variable4561 ", variable) = true
source_file.cpp:29: ; std::regex_search("  -dot.com.buble.burst ", variable) = true
 ======== EXPERIMENT 1 === Match entire string =====

 ======== EXPERIMENT 2 === Check whether text has regex =====

 ======== EXPERIMENT 3 === Extract text =====
Result1 = 85619751
Result2 = 65658741
Result3 = <<NOT MATCH>>
Result4 = <<NOT MATCH>>

 ======== EXPERIMENT 4-A === Finding all regex matches  ======
 Number of matches = 6
 => x[0] = 565
 => x[1] = 923
 => x[2] = 100
 => x[3] = 934
 => x[4] = 56
 => x[5] = 0835

 ======== EXPERIMENT 4-B === Finding all regex matches  ======
 capture[0] = ABCD367 ; capture[1] = ABCD ; capture[2] = 367
 capture[0] = XYAZ561 ; capture[1] = XYAZ ; capture[2] = 561
 capture[0] = MNPQ456 ; capture[1] = MNPQ ; capture[2] = 456

 ======== EXPERIMENT 4-C === Finding all regex matches range-based loop ===
 =>>> ABCD367
 =>>> ABCD
 =>>> 367

 ======== EXPERIMENT 5 === Replace matches  ======
 out =  {ABCD=367} -  {XYAZ=561} -  baa 341 {MNPQ=456} -  

    
                
λ
.NET NoSQL database for rapid development