From bb4f8b1fa1c8b827e2b2628718f9e1888f0045c1 Mon Sep 17 00:00:00 2001 From: araq Date: Wed, 12 Nov 2025 12:24:21 +0100 Subject: [PATCH] nimsuggest tester: remove PCRE dependency --- nimsuggest/tester.nim | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nimsuggest/tester.nim b/nimsuggest/tester.nim index 9b9488348c..c0b5dbc76f 100644 --- a/nimsuggest/tester.nim +++ b/nimsuggest/tester.nim @@ -5,7 +5,7 @@ # When debugging, to run a single test, use for e.g.: # `nim r nimsuggest/tester.nim nimsuggest/tests/tsug_accquote.nim` -import os, osproc, strutils, streams, re, sexp, net +import os, osproc, strutils, streams, sexp, net from sequtils import toSeq type @@ -148,8 +148,11 @@ proc runCmd(cmd, dest: string): bool = quit "unknown command: " & cmd proc smartCompare(pattern, x: string): bool = - if pattern.contains('*'): - result = match(x, re(escapeRe(pattern).replace("\\x2A","(.*)"), {})) + let starAt = pattern.find('*') + if starAt >= 0: + result = x.startsWith(pattern.substr(0, starAt)) and x.endsWith(pattern.substr(starAt+1)) + else: + result = x == pattern proc sendEpcStr(socket: Socket; cmd: string) = let s = cmd.find(' ')