From a89c2d3d22267db74ccb7ba6a292a2ce16f2d4ab Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Tue, 28 Jul 2026 15:37:37 -0400 Subject: [PATCH] B2026-053-Find-Unlinked-Values-of-Selected --- .../Volian.Controls.Library/DisplaySearch.cs | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index e821f5a1..bbe06f08 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -2078,9 +2078,27 @@ namespace Volian.Controls.Library if (cbxFndUnLnkROVals.Enabled && cbxFndUnLnkROVals.Checked) { - string ROSearchList2 = exactsearch(ROSearchList); // B2026-053 match exact string - // B2022-031 - added a exactsearch to filter out procedure and section titles from global search results. - SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList2, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, string.Empty, string.Empty); + string byWordPrefix = string.Empty; + string byWordSuffix = string.Empty; + + if (Regex.IsMatch(ROSearchList, @"^[\d\.]")) // starts with a number or '.' decimal pt + { + byWordPrefix = @"[^0-9a-zA-Z.vbpi:\\-]"; + } + else if (Regex.IsMatch(ROSearchList, @"^[a-zA-Z]")) // starts with a letter + { + byWordPrefix = @"[^a-zA-Z]"; + } + if (Regex.IsMatch(ROSearchList, @"[\d\.]$")) // ends with a number or decimal + { + byWordSuffix = @"[^0-9a-zA-Z.vbpi:\\-]"; + } + else if (Regex.IsMatch(ROSearchList, @"[a-zA-Z]$")) // ends with a letter + { + byWordSuffix = @"[^a-zA-Z]"; + } + string ROSearchList2 = ROSearchList; + SearchResults = ItemInfoList.GetListFromTextSearch(DVISearchList, TypeSearchList, ROSearchList2, cbxBooleanTxtSrch.Checked ? 2 : cbxCaseSensitive.Checked ? 1 : 0, cbxProcSectSrch.Checked ? 1 : 0, ItemSearchIncludeLinks.Nothing, includeRTFformat, includeSpecialChars, unitPrefix, byWordPrefix, byWordSuffix); cmbResultsStyleIndex = 3; // display step text in results } else @@ -2190,26 +2208,6 @@ namespace Volian.Controls.Library } OnSearchComplete(new DisplaySearchEventArgs(TimeSpan.FromTicks(DateTime.Now.Ticks - start.Ticks))); } - - private string exactsearch(string SearchString) // B2026-053 - { - StringBuilder ss = new StringBuilder(); - int sl = SearchString.Length; - int LstIdxSp = SearchString.LastIndexOf(' '); - if (sl == LstIdxSp + 1) // B2026-053 if ' ' the last char. - { - ss.Append(' '); - ss.Append(SearchString); // B2026-053 add a space prefix to make the search exact if the end of the searchString is a space. - } - else - { - ss.Append(' '); - ss.Append(SearchString); // B2026-053 Exact match add spaces before and after searchString. - ss.Append(' '); - } - return ss.ToString(); - } - private void ClearResults() // B2021-103 if no results when RNO only, clear results list. (moved from btnSearch_Click) { if (tabSearchTypes.SelectedTab != tabSearchTypes.Tabs[4])