---
title: "Comment by Reehan on \"Regular Expressions in JavaScript.\" | Hashnode"
description: "Hey, firstly, great article! However, in your regex replace example, I believe something&#39;s missing? Running the following will throw an error: Uncaught Refe"
url: "https://hashnode.com/posts/regular-expressions-in-javascript/5f7a4ca09c3b6e4101217b16/comment/5f7bc289e93896601dd2908b"
---

[Discussion](https://hashnode.com/posts/regular-expressions-in-javascript/5f7a4ca09c3b6e4101217b16)

Comment [Regular Expressions in JavaScript.](https://hashnode.com/posts/regular-expressions-in-javascript/5f7a4ca09c3b6e4101217b16)

[Reehan](https://hashnode.com/@the-accidental-dev)

[Oct 6, 2020](https://hashnode.com/posts/regular-expressions-in-javascript/5f7a4ca09c3b6e4101217b16/comment/5f7bc289e93896601dd2908b)

Hey, firstly, great article!

However, in your regex replace example, I believe something's missing?

Running the following will throw an error: `Uncaught ReferenceError: str is not defined`

```
var heyStr = "Hey now!";
var byeStr = "Bye";
var res = str.replace("Hey", "Bye")//returns ;
```

Shouldn't `res` = `heyStr.replace("Hey", "Bye")` ?

Similarly, the str.search() example is missing. Let me know if I'm missing something?

[Amarachi Iheanacho](https://hashnode.com/@Amara)

[Oct 11, 2020](https://hashnode.com/posts/regular-expressions-in-javascript/5f7a4ca09c3b6e4101217b16/comment/5f7bc289e93896601dd2908b#reply-5f8255bf7762251b305d957a)

Hey, thank you Reehan, I have fixed it now, please check it out.
