ECMAScript Regex for a multilined string

前端 未结 2 1202
说谎
说谎 2021-01-27 09:21

I am writing the loading procedure for my application and it involves reading data from a file and creating an appropriate object with appropriate properties.

The file c

2条回答
  •  不知归路
    2021-01-27 09:51

    Try to use:

    1. lazy quantifiers:

      === (.+?) ===\\n([\\s\\S]*?)\\n=== END \\1 ===

    2. negative classes and negative lookaheads:

      === ((?:[^ ]+| (?!===))+) ===\\n((?:[^\\n]+|\\n(?!=== END \\1 ===))*)

    3. POSIX:

      === (.+?) ===\n((.|\n)*?)\n=== END [^=]+? ===

提交回复
热议问题