I am working on some automation and I need to update the view programmatically.
UseCase: I have a jenkins view where I add all the jobs based on the release number and I do that by giving regular expression here-
I want to update this regular expression through script.
Is it possible to do the same through a groovy script?
Here is how you can update the regex filters from Groovy. I have come up with the following with the limited information you have given. You may have to improve it based on the options you have enabled in your view.
def viewObj = Jenkins.instance.getView("VIEWNAME")
List<hudson.views.ViewJobFilter> jobFilters = new ArrayList<>()
jobFilters.add(new hudson.views.RegExJobFilter('.*NEWREGEX', "includeMatched", "NAME"))
viewObj.setJobFilters(jobFilters)