Ted*_*opp 9

这个漂亮的正则表达式解释器:

NODE                     EXPLANATION
--------------------------------------------------------------------------------
  ^                      the beginning of the string
--------------------------------------------------------------------------------
  (?=                    look ahead to see if there is:
--------------------------------------------------------------------------------
  .                      any character except \n
--------------------------------------------------------------------------------
  prodCode=              'prodCode='
--------------------------------------------------------------------------------
  )                      end of look-ahead
--------------------------------------------------------------------------------
  .                      any character except \n
--------------------------------------------------------------------------------
  $                      before an optional \n, and the end of the string
Run Code Online (Sandbox Code Playgroud)

编辑

由于问题文本中的正则表达式已更改,因此解释中的倒数第二行将更改为:

--------------------------------------------------------------------------------
  .*                     any character except \n (0 or more times (matching
                         the most amount possible))
--------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

  • 问题标题中有`^(?=.*prodCode =).*$` (2认同)