title: Trouble getting regex to work with grep/sed
body: <p>I've been working on a script to update the PRODUCT_BUNDLE_IDENTIFIER in a pbxproj file with a new value using a build script. The regex I've come up with selects everything between 'PRODUCT_BUNDLE_IDENTIFIER = ' and any text following up to 2 occurrences of '.' which is what I want.</p>
  
  <p>The regex I've put together to find these occurences is shown here:</p>
  
  <pre><code>(?&lt;=PRODUCT_BUNDLE_IDENTIFIER = )([a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+){0,2})
  </code></pre>
  
  <p>I've tested it with a validator here: <a href="https://regex101.com/r/jUhJm7/1" rel="nofollow noreferrer">https://regex101.com/r/jUhJm7/1</a></p>
  
  <p>To save time, here's a screenshot with the regex applied and the green portions selected as desired, so the regex seems to be working and recognizes the bundle id portion of the following examples as expected:
  <a href="https://i.stack.imgur.com/GTKdF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GTKdF.png" alt="Regex Validated"></a></p>
  
  <p>The issue I'm experiencing is that when using this regex with grep, grep -e, egrep, or sed it doesn't seem to be working in the same manner. I would like to use sed to run the string replacement and have tried the following methods to achieve this:</p>
  
  <pre><code># variable definitions
  BUNDLE_ID='mynew.bundle.id'
  PBXFILE="$SRCROOT/myproject.xcodeproj/project.pbxproj"
  
  # check if the test bundle id is currently in the file
  if grep -Fq "REPLACEABLE_BUNDLE_ID" $PBXFILE; then
  
      # this commented version works as expected as it's using simple string replacement
      #sed -i '' "s/REPLACEABLE_BUNDLE_ID/$BUNDLE_ID/g" $PBXFILE
  
      # these are the versions of the regex I've tried with sed #
  
      # basic version working in validator &amp; testing with sublime text regex engine
      (?&lt;=PRODUCT_BUNDLE_IDENTIFIER = )([a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+){0,2})
      # added extra parentheses around product id first portion
      (?&lt;=(PRODUCT_BUNDLE_IDENTIFIER = ))([a-zA-Z0-9_]+(?:\.[a-zA-Z0-9_]+){0,2})
      # escaped version
      \(?&lt;=PRODUCT_BUNDLE_IDENTIFIER = \)\([a-zA-Z0-9_]+\(?:\.[a-zA-Z0-9_]+\){0,2}\)
  
  
      # try replacing the current bundle id using the regex
      sed -i -E '' "s/I put the regex here/$BUNDLE_ID/g" $PBXFILE
  fi
  </code></pre>
  
  <p>I'm fairly new with regex and have not used sed before. I've read about extended regular expressions here: <a href="http://www.grymoire.com/Unix/Regular.html#uh-12" rel="nofollow noreferrer">http://www.grymoire.com/Unix/Regular.html#uh-12</a> and feel like I'm just failing to put the pieces together properly.</p>