<p>As it happens, this solved my issue: <code>{{ personfirstandlastname|replace({'\'':''}) }}</code></p>

<p><strong>EDIT</strong></p>

<p>To clarify, this isn't a valid Twig object:</p>

<pre><code>{'\'',''}
</code></pre>

<p>... while this is:</p>

<pre><code>{'\'':''}
</code></pre>

CC BY-SA 3.0
2017-06-07T23:57:37.833Z
Wasn't that what you described specifically _not_ working in your question? _edit: nevermind, I see the `,` became a `:`_
Matt Stein
CC BY-SA 3.0
2017-06-08T12:52:13.270Z
@MattStein i will be increasing text sizes in my browser.
isral
CC BY-SA 3.0
2017-06-07T23:43:58.353Z
2017-06-08T00:05:00.330Z
2017-06-08T00:05:00.330Z
isral
<p>My client needs to input apostrophes in text fields for staff names, such as &rsquo; or just the plain ' and as you can imagine, it is causing issues.</p>

<p>I have tried this <code>replace({'\'',''})</code> and this <code>replace({'\&amp;rsquo;',''})</code> but to no success. Thoughts?</p>

CC BY-SA 3.0
2017-06-06T22:46:33.427Z
Can you be more specific describing the problem, isral? Plain Text fields should handle straight or curly apostrophes just fine without any special handling, and I believe Rich Text fields should be no different. I'm struggling to understand why the client inputting them is a problem _and_ why you're attempting to remove them at the template level.
Matt Stein
CC BY-SA 3.0
2017-06-07T23:40:59.617Z
Hi, @MattStein. i am removing them at the template level because i use thise text fields to create IDs which are targeted in JS/jQ. For example, if the field has "First L'ast" then JS won't be able to get the IDs because they become something like `data-target="firstl'ast"`.
isral
<templating><replace><escaping>
Remove Quotes from Text Fields
# Remove Quotes from Text Fields

(Asked by: username_0 on 2017-06-06)

My client needs to input apostrophes in text fields for staff names, such as ’ or just the plain ' and as you can imagine, it is causing issues.

I have tried this `replace({'\'',''})` and this `replace({'\’',''})` but to no success. Thoughts?

**Tags:** templating, replace, escaping
> **Comments:**
> **username_1**: Can you be more specific describing the problem, isral? Plain Text fields should handle straight or curly apostrophes just fine without any special handling, and I believe Rich Text fields should be no different. I'm struggling to understand why the client inputting them is a problem _and_ why you're attempting to remove them at the template level.  
> **username_0**: Hi, @MattStein. i am removing them at the template level because i use thise text fields to create IDs which are targeted in JS/jQ. For example, if the field has "First L'ast" then JS won't be able to get the IDs because they become something like `data-target="firstl'ast"`.  

---

## 1 answers

### Answer by username_0 on 2017-06-07. Score: 1 | Accepted answer

As it happens, this solved my issue: {{ personfirstandlastname|replace({'\'':''}) }}
EDIT
To clarify, this isn't a valid Twig object:
{'\'',''}

... while this is:
{'\'':''}

> **Comments:**
> **username_1**: Wasn't that what you described specifically _not_ working in your question? _edit: nevermind, I see the `,` became a `:`_  
> **username_0**: @MattStein i will be increasing text sizes in my browser.  

---

