# Help cleaning up old code. SEARCH seems rather poor

**URL:** <https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156>\
**Category:** General\
**Tags:** function-node\
**Created:** [30 May 2026 00:44 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156 "2026-05-30T00:44:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 May 2026 00:44 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/1 "2026-05-30T00:44:04Z")

</div>

I am not sure it is a good thing, but my past is kind of haunting me.

_WAY BACK WHEN_..... `var` was used to declare variables used in `function` node.

This has made way to `let`.

So I a thought I would go through and search for any instances of `var` used.

I already understand that `var` is not a good idea but `var ` **IS** better as it is used at the start of lines and would then have the variable name AFTER it.  
So the _trailing space_ would help in the search.

_OR SO I THOUGHT!_ (Dramatic music)

It doesn't (or doesn't seem to.)  
It finds ANY time I use the letters `var` and somehow ignores the trailing space.

Is there a way I can better search for times I use `var` rather than `let`?

For the sake of it: examples:  
(Yes, screen shots)

 ![Screenshot from 2026-05-30 10-41-31](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/30db3adb22cc16af1bf6c4c17f51cc3f5b5dd418.png)

And before you mention:  
I checked that `function` node.  
NO there are no uses of `var ` in it.  
It is because of the word `variable`.  
☹😢

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [30 May 2026 01:18 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/2 "2026-05-30T01:18:23Z")

</div>

You can scope the search to function nodes by adding `type:function`

As for searching `var ` (with space) maybe try surrounding it in double quotes? Idk 🤷

---

<div class="post-metadata">

**Author:** ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)\
**Post date:** [30 May 2026 02:09 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/3 "2026-05-30T02:09:28Z")

</div>

Had the same issue looking for a command, I exported the flows and used notepad++ to do my searching. Seemed to work ok.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 May 2026 02:25 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/4 "2026-05-30T02:25:49Z")

</div>

Thanks both.

Long, slow battle.

I'll probably go with Steve's suggestion.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2026 07:03 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/5 "2026-05-30T07:03:04Z")

</div>

Don't bother, if a function is working, and you are not working on it, then leave it as it is. If you find yourself editing a function then tidy it up but otherwise I am sure you have more important things to do.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [30 May 2026 07:05 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/6 "2026-05-30T07:05:51Z")

</div>

Yeah, but OCD really sucks.

😉

Thanks.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [30 May 2026 09:44 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/7 "2026-05-30T09:44:33Z")

</div>

> [@Colin](#):
>
> I am sure you have more important things to do

😆

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 May 2026 11:46 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/8 "2026-05-30T11:46:08Z")

</div>

> [@Steve-Mcl](#):
>
> As for searching `var ` (with space) maybe try surrounding it in double quotes?

I can confirm that does not work I'm afraid.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 June 2026 11:46 UTC](https://discourse.nodered.org/t/help-cleaning-up-old-code-search-seems-rather-poor/101156/9 "2026-06-13T11:46:39Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
