# HOW TO: Use handlebars regexReplace expression to set a null field to an empty string

**URL:** <https://connective.celigo.com/t/how-to-use-handlebars-regexreplace-expression-to-set-a-null-field-to-an-empty-string/1509>\
**Category:** Integrator.io\
**Tags:** handlebars\
**Created:** [September 11, 2020, 11:27pm UTC](https://connective.celigo.com/t/how-to-use-handlebars-regexreplace-expression-to-set-a-null-field-to-an-empty-string/1509 "2020-09-11T23:27:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![courtneyjordan](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@courtneyjordan](https://connective.celigo.com/u/courtneyjordan)\
**Post date:** [September 11, 2020, 11:27pm UTC](https://connective.celigo.com/t/how-to-use-handlebars-regexreplace-expression-to-set-a-null-field-to-an-empty-string/1509/1 "2020-09-11T23:27:36Z")

</div>

Q: If a particular field is null, I want to set the mapping to an empty string, "".   
  
A: Use the following handlebar expression to set the mapping to an empty string if the field (**note)** is null. You can use this in conjunction with the **Discard if empty** checkbox to discard this mapping if **note** is null. Here, **note** is a field reference.

```
{{#if note}}{{{regexReplace note "" "(Field name: )" w}}}{{else}}{{/if}}
```

Here are a few tips:

- Do not use any double quotes, curly braces, or parens to reference a field / variable, just type in the name
- Use double quotes to reference a hard-coded string

---

<div class="post-metadata">

**Author:** ![felipestarling](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@felipestarling](https://connective.celigo.com/u/felipestarling)\
**Post date:** [November 4, 2020, 5:38pm UTC](https://connective.celigo.com/t/how-to-use-handlebars-regexreplace-expression-to-set-a-null-field-to-an-empty-string/1509/2 "2020-11-04T17:38:06Z")

</div>

What if you would like to map to an empty cell or true null, not a empty string with, ""? I run into issues where the field will not write to the source field as a empty string, "", if the source field's data type is anything other than string.

---

<div class="post-metadata">

**Author:** ![stephenbrandt](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/stephenbrandt/32/6891_2.png) [@stephenbrandt](https://connective.celigo.com/u/stephenbrandt)\
**Post date:** [November 5, 2020, 3:23pm UTC](https://connective.celigo.com/t/how-to-use-handlebars-regexreplace-expression-to-set-a-null-field-to-an-empty-string/1509/3 "2020-11-05T15:23:23Z")

</div>

Hi, @felipestarling. I ran your question past some handlebars experts to see how that issue is usually resolved.

Of course, the data type and how it’s interpreted in a request depends on the endpoint app, but in our testing, one of these solutions usually wins out:

- Replace the empty string ("") with "null" for the value, especially when an integer is expected
- Try entering a space character (" ") for a string value
