title: How can I use sed to match a certain word and then wrap that word with quotes?
body: <p>I'm trying to use <code>sed</code> to replace all of occurrences of</p>
  
  <p><code>{% url something arg1 arg2 ... argN %}</code> with</p>
  
  <p><code>{% url 'something' arg1 arg2 ... argN %}</code> (notice the quotation marks)</p>
  
  <p>But only if <code>something</code> is not already quoted!</p>
  
  <p>I tried the following:</p>
  
  <p><code>s/{% url [^']\(\S\+\)/{% url '\1'/</code></p>
  
  <p>but that captures the first character in <code>something</code>. So the result would be:</p>
  
  <p><code>{% url 'omething' arg1 arg2 ... argN %}</code></p>
  
  <p>If I do this instead:</p>
  
  <p><code>s/{% url[^']\(\S\+\)/{% url '\1'/</code></p>
  
  <p>Then it doesn't correctly exclude the occurrences in which <code>something</code> is already quoted.</p>
  
  <p>What is the correct way to do what I mean?</p>