Copy link to clipboard
Copied
Hello friends!
What is the regular expression to modify this script so that it can do a type inverse function; instead of identifying the suffix "B", change to identify the prefix? "D item 5"?
Thanks.
dialog = new Window("dialog");
dialog.text = "Dialog";
dropdown1_array = ["Item_1 A" ,"Item_2 B" ,"Item_3 C","Item_4 B", "D item 5"]
dropdown1 = dialog.add("dropdownlist", undefined, undefined, {name: "dropdown1", items: dropdown1_array});
dropdown1.selection = 0;
dropdown1.preferredSize.width = 300;
dropdown1.onChange = function(){
if(dropdown1.selection.text.match(/B$/)){// match(/B$/)) edite
alert ("B")
}
}
dialog.show();
/^D/
Copy link to clipboard
Copied
/^D/
Copy link to clipboard
Copied
Hi Kukurykus nice to see you again! It worked here, thanks for the help.