Regex: Match everything except backreference

后端 未结 3 2065
南旧
南旧 2021-01-14 12:49

I have the following example lines:

a_a
b_c

How (using grep/egrep) would I match the lines where the first letter

3条回答
  •  深忆病人
    2021-01-14 13:00

    May be you are looking for this:

    \b([a-z])\w+(?!(\1))([a-z])\b

    it works for:

    a_a and b_c

    (tested with: The Regulator 2.0.3)

    You can then adjust this regex to meet further your needs

提交回复
热议问题