Tag: preg match all

如何在Node.js中使用我的PHP正则expression式?

我在PHP中有一个正则expression式,但是当我把它移植到Node.js时,我得到的输出和我从PHP获得的输出是不一样的,但我认为这是因为我不知道如何使PREG_SET_ORDER在Node.js中工作 示例文本: INPUT – Each line represents a line inside a text file. ————————————————————————————- "!?Text" (1234) 1234-4321 "#1 Text" (1234) 1234-???? #2 Text (1234) {Some text (#1.1)} 1234 Text (1234) 1234 Some Other Text: More Text here 1234-4321 (1234) (V) 1234 PHP: preg_match_all("/^((.*?) *\((\d+)\))(?: *\{((.*?) *\((.+?)\)) *\})?/m",$data,$r, PREG_SET_ORDER); $i = 0; foreach($r as $a) { […]