Apply the ModelView# false-positive fix to the production scanner

The standalone script already excluded internal saved-view IDs
(ModelView#<numero>) from the referenced-codes heuristic; the app's own
"Trova componenti referenziati" phase used the same regex without the fix.
Ports the lookbehind so both stay consistent, per docs/formato-asm.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
davideandClaude Sonnet 5 committed 2026-09-17 09:55:06 +02:00
1 parent 4a3f0a4cf8
commit bb99c4f4c5
2 files changed
+20 -1

No files matched your search

+6 -1
View File
@@ -16,10 +16,15 @@ namespace CadSearchGui;
/// riferimenti veri compaiono più volte nel file (una volta per feature/placement),
/// mentre il rumore binario casuale che assomiglia a un codice compare quasi sempre
/// una sola volta. Si scartano quindi i candidati con una sola occorrenza.
///
/// Falso positivo noto ed escluso: gli ID interni di viste salvate, nel formato
/// "ModelView#&lt;numero&gt;", hanno la stessa forma di un codice (8-12 cifre) e
/// compaiono più volte come un riferimento vero. Vedi docs/formato-asm.md.
/// </summary>
static class AssemblyComponentScanner
{
private static readonly Regex CodiceRegex = new(@"\b\d{8,12}(?:_[A-Za-z]\d{2,4}|[A-Za-z]{0,2})\b", RegexOptions.Compiled);
private static readonly Regex CodiceRegex = new(
@"(?<!ModelView#)\b\d{8,12}(?:_[A-Za-z]\d{2,4}|[A-Za-z]{0,2})\b", RegexOptions.Compiled);
private const int OccorrenzeMinime = 2;
public static HashSet<string> EstraiCodiciReferenziati(string percorsoAsm)