# Check if a string is a valid icon path

**URL:** <https://forum.inductiveautomation.com/t/check-if-a-string-is-a-valid-icon-path/67528>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 12, 2022, 11:40pm UTC](https://forum.inductiveautomation.com/t/check-if-a-string-is-a-valid-icon-path/67528 "2022-12-12T23:40:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Weston](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Samuel\_Weston](https://forum.inductiveautomation.com/u/Samuel_Weston)\
**Post date:** [December 12, 2022, 11:40pm UTC](https://forum.inductiveautomation.com/t/check-if-a-string-is-a-valid-icon-path/67528/1 "2022-12-12T23:40:01Z")

</div>

I'm making a dynamic template that has several buttons with icons. I want to bind the icon paths to string params of the template, but only if the path is valid.

The only solution I can think of to check this is to read the svg files as a string and search the string for the icon name, kind of like this solution for view path:  
[[feature-781]Perspective: Check if Embedded View 'path' is valid? - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/feature-781-perspective-check-if-embedded-view-path-is-valid/39583)

I really don't like this solution though, is there another expression or scripting function I can use to valid the icon path?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 13, 2022, 3:17am UTC](https://forum.inductiveautomation.com/t/check-if-a-string-is-a-valid-icon-path/67528/2 "2022-12-13T03:17:09Z")

</div>

If the icon path doesn't exist, it won't show anything. Is that an issue?

---

<div class="post-metadata">

**Author:** ![Samuel\_Weston](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@Samuel\_Weston](https://forum.inductiveautomation.com/u/Samuel_Weston)\
**Post date:** [December 13, 2022, 4:09am UTC](https://forum.inductiveautomation.com/t/check-if-a-string-is-a-valid-icon-path/67528/3 "2022-12-13T04:09:57Z")

</div>

Yep, just getting carried away with validating
