<p>How to match a single quote in sed if the expression is enclosed in single quotes:</p>

<pre><code>sed -e '...'
</code></pre>

<p>For example need to match this text:</p>

<pre><code>'foo'
</code></pre>

You can either use:
```
```
"texta'textb" (APOSTROPHE inside QUOTATION MARKs)
```
```
or
```
```
'texta'\''textb' (APOSTROPHE text APOSTROPHE, then REVERSE SOLIDUS, APOSTROPHE, then APOSTROPHE more text APOSTROPHE)
```
```
I used unicode character names. REVERSE SOLIDUS is more commonly known as backslash.
In the latter case, you close your apostrophe, then shell-quote your apostrophe with a backslash, then open another apostrophe for the rest of the text.