title: Correct way to add comments to a Regular Expression in PHP
body: <p>I'm trying to add comments to make a regexp clearer</p>
  
  <pre><code>// Strip any URLs (such as embeds) taken from http://stackoverflow.com/questions/6427530/regular-expression-pattern-to-match-url-with-or-without-http-www
  $pattern =
      '(                               # First capturing group
              (http|https)             # Second capturing grout,matches wither http or https
          \:\/\/)?                     # End of first capturing group, matches :// exactly
          [                            # Match any char in the following list. the + after the closing bracke means greedy
              a-z                      # Any char between a and z
              A-Z                      # Any char between A and Z
              0-9                      # Any char between 0 and 9
              \.\/\?\:@\-              # ./?:@- literally ( any one of them )
              _=#                      # _=# any of these thre chars
          ]+                           # end of list
          \.                           # matches .
          (                            # third caturing group
              [                        # start of list
                  a-z                  # Any char between a and z
                  A-Z                  # Any char between A and Z
                  0-9                  # Any char between 0 and 9
                  \.\/\?\:@\-          # ./?:@- literally ( any one of them )
                  _=#                  # _=# any of these thre chars
              ]                        # end of list
          )*                           # end of capturing group with greedy modifier';
  $excerpt = preg_replace("/$pattern/x", '', $excerpt );
  </code></pre>
  
  <p>But i get the warning </p>
  
  <blockquote>
    <p>Warning: preg_replace(): Unknown modifier '/' in on line 280</p>
  </blockquote>
  
  <p>How should i comment it?</p>