Regex to match only the first line?

前端 未结 4 1212
自闭症患者
自闭症患者 2021-02-01 17:32

Is it possible to make a regex match only the first line of a text? So if I have the text:

This is the first line.
This is the second line. ...

It would matc

4条回答
  •  旧时难觅i
    2021-02-01 18:21

    In case you need the very first line no matter what, here you go:

     \A.*
    

    It will select the first line, no matter what.

提交回复
热议问题