# Switch Node: Does not contain

**URL:** <https://discourse.nodered.org/t/switch-node-does-not-contain/16136>\
**Category:** General\
**Created:** [1 October 2019 08:43 UTC](https://discourse.nodered.org/t/switch-node-does-not-contain/16136 "2019-10-01T08:43:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)\
**Post date:** [1 October 2019 08:43 UTC](https://discourse.nodered.org/t/switch-node-does-not-contain/16136/1 "2019-10-01T08:43:27Z")

</div>

I have a device (Smartmeter) that sends strings.  
All strings start with a number, for example 0-1:96.1.0 and then a value (1234.56\*) and ends with carriage return  
The smartmeter does sometimes send carriage return before the value is transmitted.  
I filter most messages with the switch node using [string contains 0-1:96.1.0]

But how do I get the one string that doesn't start with 0-1: ?  
Is there a function or something that does: [string does not contain 0-] ?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3afeaf1368a95a72705b513366457fa75a921e76.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [1 October 2019 08:54 UTC](https://discourse.nodered.org/t/switch-node-does-not-contain/16136/2 "2019-10-01T08:54:08Z")

</div>

Use a function node:

```auto
m = msg.payload.replace("(","").replace(")","")
msg.payload = parseFloat(m)

return msg;

```

---

<div class="post-metadata">

**Author:** ![Nice\_to\_have](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nice\_to\_have](https://discourse.nodered.org/u/Nice_to_have)\
**Post date:** [1 October 2019 09:04 UTC](https://discourse.nodered.org/t/switch-node-does-not-contain/16136/3 "2019-10-01T09:04:24Z")

</div>

Thanks a million 🥳

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 October 2019 09:27 UTC](https://discourse.nodered.org/t/switch-node-does-not-contain/16136/4 "2019-10-01T09:27:09Z")

</div>

> [@Nice\_to\_have](#):
>
> Is there a function or something that does: [string does not contain 0-] ?

You can do that in a `switch` node. Set the first as you have done to ` [string contains 0-1:96.1.0]` and the add a second rule set to `otherwise`
