title: Find a pattern and surround it with quotes
body: <p>So I'm upgrading from Django 1.3 > 1.4 and there's a requirement for patterns of <code>{% url app:X:Y %}</code> to be <code>{% url "app:X:Y" %}</code>. There are 493 instances of this pattern in the project, thus I'm trying to find how to automate it.</p>
  
  <p>To be clear there could be further words within the brackets but it's always the one after <code>"{% url "</code> and up until the next space I have to wrap.</p>
  
  <p>I checked out <code>sed</code> but I'm not sure how to get that working correctly with <code>grep</code>. Does anyone have an example of something that would work here?</p>
  
  <p>See it with a sample file:</p>
  
  <p>This file has 2 urls but it should only catch the 2nd one (the grep isn't really the issue, it's the replacing.) This file should be the exact same except <code>{% url admin:index %}</code> should be <code>{% url "admin:index" %}</code></p>
  
  <pre><code>{% extends "admin/index.html" %}
     {% load i18n %}
     {% load url from future %}
  
    {% if not is_popup %}
    {% block breadcrumbs %}
    &lt;div class="breadcrumbs"&gt;
    &lt;a href="{% url admin:index %}"&gt;{% trans 'Home' %}&lt;/a&gt;
    &amp;rsaquo;
    {% for app in app_list %}
  </code></pre>
  
  <p>This is a grep that finds all cases, but it fails on ones that already have quotes around them and of course it does not actually edit them <code>grep -r "{% url .* " .</code></p>