我的一行文字看起来像这样:
Arnold Sweet - A+
Ashley C. D. - B+
Steve Crook Dewl - A-
Tanya A - Absence w/e
以及更多......
我如何制作所有行:
A+ - Arnold Sweet
B+ - Ashley C. D.
A- - Steve Crook Dewl
Absence w/e - Tanya A
TNX
答案 0 :(得分:2)
^(.+?) - (.+?)$
$2 - $1
. matches newline
<强>解释强>
^ : begining of line
(.+?) : group 1, 1 or more any character, not greedy
- : literally a space, a dash, a space
(.+?) : group 2, 1 or more any character, not greedy
$ : end of line