大家好,我需要在Notepad ++上切换单词位置,就像这样。
hello word|miauw
tommorow is nice|hhello
work hard|world
hello hello|day
我想要反转管道前后字的相对位置(|
):
miauw|hello word
hhello|tommorow is nice
world|work hard
day|hello hello
答案 0 :(得分:0)
这将完成这项工作:
^(.+?)\|(.+?)$
$2|$1
Regular expression
,但不能. matches newline
<强>解释强>
^ : begining of line
(.+?) : group 1, any character, 1 or more, not greedy (ie. until a ` character)
\| : a pipe, escaped because it has special meaning within a regex
(.+?) : group 2 (same as group 1)
$ : end of line