Source:
<code>protected void setDefaultProfileAttributes(ILaunchConfigurationWorkingCopy wc) { final String providerId = ProviderLaunchConfigurationDelegate.getProviderIdToRun(wc, getProfilingType()); final String providerToolName = ProviderFramework.getProviderToolNameFromId(providerId); final ProfileLaunchConfigurationTabGroup tabgroup = ProfileLaunchConfigurationTabGroup.getTabGroupProviderFromId(providerId); ILaunchConfigurationDialog dialog = new ILaunchConfigurationDialog() { public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) { throw new UnsupportedOperationException (); } public void updateMessage() { throw new UnsupportedOperationException (); } public void updateButtons() { throw new UnsupportedOperationException (); } public void setName(String name) { throw new UnsupportedOperationException (); } public void setActiveTab(int index) { throw new UnsupportedOperationException (); } public void setActiveTab(ILaunchConfigurationTab tab) { throw new UnsupportedOperationException (); } public ILaunchConfigurationTab[] getTabs() { return null; } public String getMode() { return null; } public ILaunchConfigurationTab getActiveTab() { return null; } public String generateName(String name) { if (name == null) { name = ""; } String providerConfigutationName = generateProviderConfigurationName(name, providerToolName); return getLaunchManager().generateLaunchConfigurationName(providerConfigutationName); } }; tabgroup.createTabs(dialog , "profile"); for (ILaunchConfigurationTab tab : tabgroup.getTabs()) { tab.setLaunchConfigurationDialog(dialog); tab.setDefaults(wc); } ProfileLaunchShortcut shortcut= ProviderFramework.getLaunchShortcutProviderFromId(providerId); shortcut.setDefaultProfileLaunchShortcutAttributes(wc); wc.setAttribute(ProviderProfileConstants.PROVIDER_CONFIG_ATT, providerId); wc.setAttribute(ProviderProfileConstants.PROVIDER_CONFIG_TOOLNAME_ATT, providerToolName); String curConfigName = wc.getName(); <START> Pattern configNamePattern = Pattern.compile(".+\\s\\[.+\\]\\s(\\(\\d\\))?$"); END> Matcher match = configNamePattern.matcher(curConfigName); if (!match.find()) { wc.rename(dialog.generateName(curConfigName)); } }</code><technical_language>I this expression is correct for fact brackets digit contained match a single digit, I match 1 more digits</technical_language>

Target:
protected void setDefaultProfileAttributes(ILaunchConfigurationWorkingCopy wc) { final String providerId = ProviderLaunchConfigurationDelegate.getProviderIdToRun(wc, getProfilingType()); final String providerToolName = ProviderFramework.getProviderToolNameFromId(providerId); final ProfileLaunchConfigurationTabGroup tabgroup = ProfileLaunchConfigurationTabGroup.getTabGroupProviderFromId(providerId); ILaunchConfigurationDialog dialog = new ILaunchConfigurationDialog() { public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) { throw new UnsupportedOperationException (); } public void updateMessage() { throw new UnsupportedOperationException (); } public void updateButtons() { throw new UnsupportedOperationException (); } public void setName(String name) { throw new UnsupportedOperationException (); } public void setActiveTab(int index) { throw new UnsupportedOperationException (); } public void setActiveTab(ILaunchConfigurationTab tab) { throw new UnsupportedOperationException (); } public ILaunchConfigurationTab[] getTabs() { return null; } public String getMode() { return null; } public ILaunchConfigurationTab getActiveTab() { return null; } public String generateName(String name) { if (name == null) { name = ""; } String providerConfigutationName = generateProviderConfigurationName(name, providerToolName); return getLaunchManager().generateLaunchConfigurationName(providerConfigutationName); } }; tabgroup.createTabs(dialog , "profile"); for (ILaunchConfigurationTab tab : tabgroup.getTabs()) { tab.setLaunchConfigurationDialog(dialog); tab.setDefaults(wc); } ProfileLaunchShortcut shortcut= ProviderFramework.getLaunchShortcutProviderFromId(providerId); shortcut.setDefaultProfileLaunchShortcutAttributes(wc); wc.setAttribute(ProviderProfileConstants.PROVIDER_CONFIG_ATT, providerId); wc.setAttribute(ProviderProfileConstants.PROVIDER_CONFIG_TOOLNAME_ATT, providerToolName); String curConfigName = wc.getName(); Pattern configNamePattern = Pattern.compile(".+\\s\\[.+\\](\\s\\(\\d+\\))?$"); Matcher match = configNamePattern.matcher(curConfigName); if (!match.find()) { wc.rename(dialog.generateName(curConfigName)); } }