Cannot get regular expression work correctly with multiline

前端 未结 4 2229
南笙
南笙 2020-12-15 06:16

I have a quite big XML output from an application. I need to process it with my program and then feed it back to the original program. There are pieces in this XML which nee

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 07:11

    The regex char "." never matches a newline, even with MultiLine option is set. instead, you should use [\s\S] or other combination with matches anything.

    The MultiLine option only modifies the behaviour of ^ (begin-of-line instead fo begin-of-string) and $ (end-of-line instead of end-of-string)

    BTW: Indeed, regex is not the right way to scan an HTML...

提交回复
热议问题