title: Regex: Replacing only one occurrence
body: <p>I'm trying to replace only one instance of a specific word in a string using regex, where the word that needs to be substituted appears at least twice. For instance I have the following:</p>
  
  <p><code>The NOUN is ADJECTIVE and is completely different from the NOUN.</code>  </p>
  
  <p>so far I have:</p>
  
  <pre><code>content = 'The NOUN is ADJECTIVE and is completely different from the NOUN.'   
  
  noun = input('Enter a noun: ')
  adj = input('Enter an adjective: ')
  noun_1 = input('Enter another noun: ')
  
  names_regex_noun = re.compile(r'NOUN')
  content = names_regex_noun.sub(noun, content)
  names_regex_adj = re.compile(r'ADJECTIVE')
  content = names_regex_adj.sub(adj, content)
  names_regex_noun_1 = re.compile(r'NOUN')
  content = names_regex_noun_1.sub(noun_1, content) 
  print(content)
  </code></pre>
  
  <p>The problem that I'm having is that when using <code>names_regex_noun.sub(noun, content)</code> it is replacing both instances of <code>NOUN</code> in <code>content</code>. I would like to only replace the first and leave the second instance of <code>NOUN</code> unaffected so that it could be substituted by <code>noun_1</code>. </p>