Why isn't my Twig replace filter working with craft.request.getUrl()?
Try:

{{ pages|replace({('data-url="' ~ craft.request.getUrl() ~ '"'): 'class="active"'})|raw }}


You were double nesting Twig tags {{ {{ }} }}, which is never necessary.  You'll want to use string concatenation instead. Also for dynamic keys in twig you need parentheses.