Answers.Body: <p>I'm just gonna post my comment as an answer, because I think it's the way to go.</p>
  
  <p>I'd use the <a href="http://buildwithcraft.com/docs/templating/filters#kebab" rel="nofollow"><code>kebab</code> filter</a> instead of <code>url_encode</code>, like this: <code>{jobTitle|kebab}</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-11T12:11:14.823Z
Answers.Text: Thank you Megatrond, I didn't know about this one, I'll give it a go now!
Answers.UserDisplayName: Pathfinder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-11T12:16:26.083Z
Answers.Text: Yes, this worked a treat. Much cleaner code! Many thanks.
  
      jobs/{jobTitle|kebab}-{jobCity|kebab}-{jobId|kebab}
Answers.UserDisplayName: Pathfinder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-10T17:39:02.663Z
Answers.LastActivityDate: 2015-08-10T17:39:02.663Z
Answers.UserDisplayName: megatrond
Body: <p>any help on this one appreciated.</p>
  
  <p>I have an entry url that is automated to take several fields and make the the uri.</p>
  
  <p>It pulls the jobTitle, jobCity and jobId fields and then... well... this:</p>
  
  <pre><code>jobs/{jobTitle|lower|url_encode|replace("%20", "-")|replace("%2C","")|replace("%80","")|replace("%E2","")|replace("%8B", "")}-{jobCity|lower|url_encode|replace("%20", "-")|replace("%27", "")}-{jobId}
  </code></pre>
  
  <p>As you can see... it is a tad... long.</p>
  
  <p>The problem I have is the % stuff that creeps in. Some times the job titles have odd characters that the url encode converts into % symbols. These then break the url and stop craft from displaying the page.</p>
  
  <p>My short term solution has been to add lots of replace's for each one, but is there way to make a replace that uses a wildcard - so if it sees % it replaces the next two characters as well?</p>
  
  <p>Something like:</p>
  
  <pre><code>|replace("%wildcard","-") etc
  </code></pre>
  
  <p>The current replaces work, but it just feels unwieldy.</p>
  
  <p>Many thanks for any advice.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-10T13:36:56.350Z
Comments.Text: Might the [kebab filter](http://buildwithcraft.com/docs/templating/filters#kebab) do what you're after? As in `{jobTitle|kebab}` that is.
Comments.UserDisplayName: megatrond
Tags: <templating><replace>
Title: Is it possible to create a cleaner replace?
ThreadText: # Is it possible to create a cleaner replace?
  
  (Asked by: username_0 on 2015-08-10)
  
  any help on this one appreciated.
  
  I have an entry url that is automated to take several fields and make the the uri.
  
  It pulls the jobTitle, jobCity and jobId fields and then... well... this:
  
  ```
  jobs/{jobTitle|lower|url_encode|replace("%20", "-")|replace("%2C","")|replace("%80","")|replace("%E2","")|replace("%8B", "")}-{jobCity|lower|url_encode|replace("%20", "-")|replace("%27", "")}-{jobId}
  
  ```
  
  As you can see... it is a tad... long.
  
  The problem I have is the % stuff that creeps in. Some times the job titles have odd characters that the url encode converts into % symbols. These then break the url and stop craft from displaying the page.
  
  My short term solution has been to add lots of replace's for each one, but is there way to make a replace that uses a wildcard - so if it sees % it replaces the next two characters as well?
  
  Something like:
  
  ```
  |replace("%wildcard","-") etc
  
  ```
  
  The current replaces work, but it just feels unwieldy.
  
  Many thanks for any advice.
  
  **Tags:** templating, replace
  
  > **Comments:**
  > **username_1**: Might the [kebab filter](http://buildwithcraft.com/docs/templating/filters#kebab) do what you're after? As in `{jobTitle|kebab}` that is.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-08-10. Score: 3 | Accepted answer
  
  I'm just gonna post my comment as an answer, because I think it's the way to go.
  
  I'd use the [`kebab` filter](http://buildwithcraft.com/docs/templating/filters#kebab) instead of `url_encode`, like this: `{jobTitle|kebab}`
  
  > **Comments:**
  > **username_0**: Thank you username_1, I didn't know about this one, I'll give it a go now!  
  > **username_0**: Yes, this worked a treat. Much cleaner code! Many thanks.      jobs/{jobTitle|kebab}-{jobCity|kebab}-{jobId|kebab}  
  
  ---
  
  