行ごとに文字列を処理したいが、複数行のサポートを有効にしたい。今のところ、このコードの出力 lines = [l for l in text.splitlines()]
print lines
: First line
Second line
{{{
these three lines
I want to process
together
}}}
Last Line
が、私
mを使用するphp function複数行の文字列から不要な空白をすべて削除する関数を作成したいとします。 それは働いていない正規表現は、最後にスペースを削除いずれかになります。 // Always trim at the end. Warning: this seems to be the costlier
// operation, perhaps because looking ahead
正規表現を使用してGEDCOMファイルを解析しようとしていますが、行末にオプションのテキストがある行のテキストの次の行を取得します。各レコードは1行にする必要があります。 これは、ファイルからの抜粋です: 0 HEAD
1 CHAR UTF-8
1 SOUR Ancestry.com Family Trees
2 VERS (2010.3)
2 NAME Ancestry.com Fami