# How to retrieve the only number from a string?

Suppose there is a pop-up like below which has a combination of text and Numbers and if we want to retrieve only Numbers

 ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/37Vl6TyTQQZrwln0-4a8abfd1470a.png)Then we can use the below code to fetch only Numbers

Store the content into a variable and apply to replace(/\[^0-9\]/g, "") to the string and it will fetch only Numbers present in the string

Code Snippet

 ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/2A27FJYuVkkC7Kzj-707078d81a01.png)Logs from DS3

 ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/mk20zD2tAxibziLH-9c5945c2b1fe.png)<div id="bkmrk-last-updated%3A-june-2">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">June 26, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>