# Using Wildcards in String Inspecting

**URL:** <https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004>\
**Category:** Revit\
**Created:** [August 18, 2023, 12:55pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004 "2023-08-18T12:55:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan.buckingham](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dan.buckingham/32/168139_2.png) [@dan.buckingham](https://forum.dynamobim.com/u/dan.buckingham)\
**Post date:** [August 18, 2023, 12:55pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/1 "2023-08-18T12:55:50Z")

</div>

Can someone please explain to me how to use wildcards correctly?  
My end goal is to create a script that replaces any material asset that ends with (number) with the same asset without that suffix.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/644761f1f17293ca9642ad36d5b219be4e8e05c1.png)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [August 18, 2023, 1:39pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/2 "2023-08-18T13:39:06Z")

</div>

Hello,  
Maybe this way

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/0/a01756415ffbf23b92fa7fb6c98532c031f5848b.png)

cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [August 18, 2023, 2:05pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/3 "2023-08-18T14:05:55Z")

</div>

Assuming that only the names with a number have parenthesis, you can use string contains and search for " ( " or " ) " and filter the list that way.

Or you can use what you got and change the code block to " ) ".

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/d/9d45b5a1546691f4dc00191bbb3983ab54b48cc7.png)

---

<div class="post-metadata">

**Author:** ![dan.buckingham](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dan.buckingham/32/168139_2.png) [@dan.buckingham](https://forum.dynamobim.com/u/dan.buckingham)\
**Post date:** [August 18, 2023, 2:12pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/4 "2023-08-18T14:12:29Z")

</div>

Unfortunately there are some appearance assets with parenthesis in the name, so that approach to filtering isn’t great here. Am I wrong to think the \* should be the way to represent a wildcard?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [August 18, 2023, 2:32pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/5 "2023-08-18T14:32:25Z")

</div>

With the Clockwork package  
([for codes](https://ironpython-test.readthedocs.io/en/latest/howto/regex.html))

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/4/d42c246b1096ce8833da7618bfbfec708a5446f7.png)

edit: I made a syntax error about the incoming Regex"

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/c/ac73bbf6786039c723507a4eb4d429b23613078c.png)

cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [August 18, 2023, 6:24pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/6 "2023-08-18T18:24:37Z")

</div>

Similar method as what @christian.stan suggests. Instead of using asterisk, create your search list and use Strings.SearchListForStringContains from Lunchbox.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/6/16cb9c195957fbdfbdfad5d8ba090cfe880aeb2e.png)

---

<div class="post-metadata">

**Author:** ![dan.buckingham](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dan.buckingham/32/168139_2.png) [@dan.buckingham](https://forum.dynamobim.com/u/dan.buckingham)\
**Post date:** [August 21, 2023, 2:59pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/7 "2023-08-21T14:59:43Z")

</div>

Great thanks, is there something similar I can do for duplicates beyond 9? For example I have an example project with Generic (60) asset name.

I don’t mind having multiple passes to filter the list down.

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [August 21, 2023, 3:17pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/8 "2023-08-21T15:17:05Z")

</div>

Just change the 9 to 60 or whatever number you want to set the max range to. I just used 9 for the example. If you will never have any with (0) in the name, then start the range at 1. Change to [1…60] in the code block.

---

<div class="post-metadata">

**Author:** ![dan.buckingham](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/dan.buckingham/32/168139_2.png) [@dan.buckingham](https://forum.dynamobim.com/u/dan.buckingham)\
**Post date:** [August 21, 2023, 3:19pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/9 "2023-08-21T15:19:49Z")

</div>

That simple! Thanks.

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [August 21, 2023, 3:32pm UTC](https://forum.dynamobim.com/t/using-wildcards-in-string-inspecting/93004/10 "2023-08-21T15:32:39Z")

</div>

hello  
change in 2 code blocks and cross product

 ![Forum english 18 aout 2023 rep1_2023-08-21_05-29-02](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b733a4935901dfa3f0b7aaa51dd2774924d0d8a.png)

cordially  
christian.stan
