This script was created by another user and then I tweaked it a bit, you can see more about it on this post
This is the script:
#target illustrator
var doc = app.activeDocument;
jsfind = prompt("Find: ", "");
jsreplace = prompt("Replace: ", "");
for ( var i=0; i<doc.artboards.length ;i++) {
var aBoard = doc.artboards[i].active;
var oldName = doc.artboards[i].name;
doc.artboards[i].name = oldName.replace (jsfind, jsreplace);
}
I want to make jsfind
use regex for "find"
If I just switch
oldName.replace (jsfind, jsreplace);
to
oldName.replace (/jsfind/g, jsreplace);
It doesn't function properly, I assume I have to excape the characters or something, but I'm not sure.