I am trying to extract a string between two patterns from another string in C++.
Example of input: "C++ is not that easy"
Pattern1: "C++"
Pattern2: "that"
Result: " is not "
I would like to loop this operation to extract all matchin开发者_如何转开发g strings from binary file later.
The best way for this is to use regular expressions.
You can read more about it here
You can use string::find() to find the position of each pattern within the input, string::length() to find the end position of the first pattern (since find() gives the start),and then string::substr() to extract the substring between those positions.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论