• regexp -stop option?

    From oleg.o.nemanov@gmail.com@21:1/5 to All on Tue Sep 28 06:11:20 2021
    Hi, all.

    There is regexp -start option, but no -stop option. How can i tell regexp command to stop matching at some position? May be i missed something?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From heinrichmartin@21:1/5 to oleg on Wed Sep 29 01:35:26 2021
    On Tuesday, September 28, 2021 at 3:11:22 PM UTC+2, oleg wrote:
    Hi, all.

    There is regexp -start option, but no -stop option. How can i tell regexp command to stop matching at some position? May be i missed something?

    Use string range (or string replace) to remove the unwanted part of the string. Unlike for -start this does not temper with the indices.

    Two caveats:
    Edge case: Depending on whether look-ahead matches should have matched beyond -stop, this might not suit your expectation.
    Performance: String range (and string replace) require copying (new Tcl_Obj and memcpy), but I guess the overall impact is acceptable.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From oleg.o.nemanov@gmail.com@21:1/5 to All on Wed Sep 29 02:47:30 2021
    среда, 29 сентября 2021 г. в 11:35:28 UTC+3, heinrichmartin:
    On Tuesday, September 28, 2021 at 3:11:22 PM UTC+2, oleg wrote:
    Hi, all.

    There is regexp -start option, but no -stop option. How can i tell regexp command to stop matching at some position? May be i missed something?
    Use string range (or string replace) to remove the unwanted part of the string. Unlike for -start this does not temper with the indices.

    That's exactly what i'm doing now. But this is extra performance impact.

    Two caveats:
    Edge case: Depending on whether look-ahead matches should have matched beyond -stop, this might not suit your expectation.

    May be, but -stop would be convenient in any case :-).

    Performance: String range (and string replace) require copying (new Tcl_Obj and memcpy), but I guess the overall impact is acceptable.

    May be you are right.

    Thanks!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)