Textwrangler 中的正则表达式 - 删除两个字符之间的字符串

Regex in Textwrangler - Remove String Between Two Characters

我有一个文本文件,其中包含多个热门城市的天气统计信息,其中不仅包括当天的最高和最低气温,还包括昨天的天气,如下所示:

City/Town, State;Yesterday’s High Temp (F);Yesterday’s Low Temp (F);Today’s High Temp (F);Today’s Low Temp (F);Weather Condition;Wind Direction;Wind Speed (MPH);Humidity (%);Chance of Precip. (%);UV Index

Atlanta, GA;43;22;44;22;Partly sunny, chilly;NW;9;38%;7%;4
Atlantic City, NJ;45;24;37;9;A snow squall;WNW;22;36%;58%;3
Baltimore, MD;40;23;34;8;A snow squall, windy;NW;19;37%;57%;1
Bismarck, ND;-10;-29;-8;-15;Frigid;SSE;6;73%;58%;2

我希望能够输入一个正则表达式命令,该命令将删除状态后的前两个数字,删除昨天的高温和低温,使其看起来像这样:

City/Town, State;Yesterday’s High Temp (F);Yesterday’s Low Temp (F);Today’s High Temp (F);Today’s Low Temp (F);Weather Condition;Wind Direction;Wind Speed (MPH);Humidity (%);Chance of Precip. (%);UV Index

Atlanta, GA;44;22;Partly sunny, chilly;NW;9;38%;7%;4
Atlantic City, NJ;37;9;A snow squall;WNW;22;36%;58%;3
Baltimore, MD;34;8;A snow squall, windy;NW;19;37%;57%;1
Bismarck, ND;-8;-15;Frigid;SSE;6;73%;58%;2

有没有简单的方法来做到这一点?

匹配部分:

-?\d+;-?\d+;(-?\d+;-?\d+)

替补:


分解:

Check for possible hyphen
-?
Check for number
\d+
Check for semicolon
;
Do the above again
-?\d+;
Start of capturing group
(
Do above check 2 times again
-?\d+;-?\d+
End of capturing group
)

</code>表示替换为第一个捕获组的内容</p> <p>如果你不想做任何替换,你也可以使用这个:</p> <pre><code>-?\d+;-?\d+;(?=-?\d+;-?\d+)

它利用前瞻检查它前面是否还有两个数字。