Problem with replacing string by regex


#1

Hello,

I have an issue with replacing strings with regex from Clockwork package. When there is two match in a string it creates two different string as an output instead of replacing the matches.
See image attached, it is self-explanatory. Any suggestion appreciated.


#2

@daninet Please post your dyn or a link to it


#3

RegEx.dyn (32.4 KB)
RegEx_test.rvt (336 KB)


#4

Looks like a list @ level issue


#5

Tried the lacings and levels, seen no difference. If you may have time take a look on it in the sample revit I have included.

Thank you


#6

Also, the output of the Number.ToString node is split into two items at index 2. I‘d try to turn that into a multiline string and then experiment with list@level on the second regex node again. Can’t look at your sample since i‘m On a mobile.
Edit: and you might need to turn on multiline matching, too.


#7

The FindRegEx node outputs two elements for index two. It will find the same two item in the replace as well. Logic would say you have to input two element as it will find two so it can replace two.
I don’t really know how would you solve this with a single string.


#8

I see the issue now. It’ll be easier to just take the strings apart entirely, change the numeric values and then glue them back together.


RegExEdited.dyn (38.7 KB)