Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
diff3 コマンドからの出力を解析しています。いくつかの行は次のようになります。
1:1,2c 2:0a
真ん中の数字が気になります。単一の数値またはコンマで区切られた数値のペアのいずれかです。正規表現を使用すると、次のように両方をキャプチャできます。
/^\d+:(\d+)(?:,(\d+))?[ac]$/
Luaで最も単純に同等のものは何ですか? オプションの 2 番目の数値があるため、その正規表現を string.match に直接変換することはできません。