0

PHP スクリプトを Nodejs に移植しようとしています。ほとんどの作業を行いましたが、これを解決できませんでした:

preg_match_all("@(==[^=]+==)(.+?(?=[^=]==[^=]|$))@s", $this->source, $paragraphs);

JS バージョンはどのようになりますか? 私は次のことを試しました:

this.content.match(/(==[^=]+==)(.+?(?=[^=]==[^=]|$))/ig);

しかし、結果は散々です。

sフラグを追加すると、次のようになります。

SyntaxError: Invalid flags supplied to RegExp constructor 'igs'
at new RegExp (<anonymous>)
at WikiParser.makeContent (D:\Smartly\application\models\parser.js:14:2)
at D:\Smartly\application\models\parser.js:63:10
at Request._callback (D:\Smartly\application\models\webworker.js:21:3)
at Request.self.callback (D:\Smartly\node_modules\request\request.js:129:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request.<anonymous> (D:\Smartly\node_modules\request\request.js:873:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage.<anonymous> (D:\Smartly\node_modules\request\request.js:824:12)
 at IncomingMessage.EventEmitter.emit (events.js:117:20)
4

0 に答える 0