^持つ:。 s = "Why did you foo bar a <b>^f('y')[f('x').get()]^? and ^f('barbar')^</b>"
私は、例えば、文字列で^f('y')[f('x').get()]^と^f('barbar')^を交換するにはどうすればよいですPLACEXHOLDER? 所望の出力は次のようになります。 Why did you foo bar a
をre.findall:Pythonは、同様に私をテキスト2与えなぜ import re
stringtotest = "begin:Text1<wrong>Text2<wrong>Text3<right>Text4<wrong>"
right = re.findall("<wrong>(.+?)<right>",stringtotest)
>>> right
['Text2<wrong>
C++ 11 RegExに少し問題があります。私はgreedynesについて考えています。 ここは少しサンプルです。 #include <stdio.h>
#include <string>
#include <regex>
int main (void)
{
std::string in="{ab}{cd}[ef]{gh}[ij][kl]"; // the input-str
私は文章であるテキストをいくつか持っていますが、そのうちのいくつかは質問です。私は特定のフレーズ、つまり「NSF」を含む質問のみを抽出します正規表現を作成しようとしています:理想的 import re
s = "This is a string. Is this a question? This isn't a question about NSF. Is this one about NSF?