ID:2959581
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
I don't know regex.

if I want to strip a bunch of characters (ie numbers) from a string, I have to either use 10 replacetexts or regex.

Allowing Needle to be a list would be fantastic.

Total rabbit hole, but passing an asslist instead of needle and replacement would be the tits.
"Learn regex" is a flippant interjection but I do think for rote replacement it's very worth using:

https://i.imgur.com/CwGNbPA.png
https://pastebin.com/mt9pEYT1

Being able to pass a list for needle and a list for replacement, or an alist in the needle position, would be neat as you say - especially if the list entries could be any currently accepted argument. eg:

/proc/gimme_op()
return "op"

var/hopscotch = replacetext("haystack",
list(regex("tack", "g"), "ay"),
list("cotch", /proc/gimme_op)
)

var/also_hopscotch = replacetext("haystack", alist(
regex("tack", "g") = "cotch",
"ay" = /proc/gimme_op
))

Login to reply.