Regex find instance of dash, but not dash

后端 未结 3 1435
南笙
南笙 2021-01-18 13:06

I am sooo close. I am trying code a regex expression for Notepad++ to replace a dash with a space, ignoring dashes already with a pre/post space. I realize I could

3条回答
  •  有刺的猬
    2021-01-18 13:51

    To ignore dashes already with a pre/post space you could use positive lookarounds to assert that what is on the left and on the right are a non whitespace character \S

    In the replacement use a space.

    (?<=\S)-(?=\S)

    Regex demo

提交回复
热议问题