iterative re_replace

   970   4   0
User Avatar
Member
648 posts
Joined: July 2005
Offline
Having a problem with vex re_replace:
re_replace(";;",";-;","1;;;;5")
returns: “1;-;;-;5”,
but want: “1;-;-;-;5”.

Is there a way to do this without putting it in a loop?
User Avatar
Member
8617 posts
Joined: July 2007
Offline
I don't think there is such functionality built in, it would be also extremely dangerous as it's so easy to get infinite loops that way

so just do your own loop or wrapper function around re_replace() that does will internally run it recursively
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
648 posts
Joined: July 2005
Offline
tamte
so just do your own loop or wrapper function around re_replace() that does will internally run it recursively
yep tried that; was too slow with 500'000 records with 50 fields each.
Trying to do this because vex split() doesn't work with empties, eg:
split("1;;;;5",";")
returns
[1,5]
Edited by anon_user_40689665 - March 11, 2020 22:57:12
User Avatar
Member
8617 posts
Joined: July 2007
Offline
cpb
Trying to do this because vex split() doesn't work with empties
use
re_split(";", "1;;;;5");
Edited by tamte - March 11, 2020 23:22:04
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
648 posts
Joined: July 2005
Offline
perfect thanks!
  • Quick Links