• BUG or FEATURE "regexp -line..." bypass newline

    From aotto1968@21:1/5 to All on Fri Feb 16 12:42:24 2024
    Hi, after spend a couple of time to check some "unwanted" behavior I figure out that
    "regexp -line…" bypass the newline "\n" -line border !!

    mfg ao


    =========================================================================== #!/bin/env tclsh

    set txtS {

    \noop BEGIN-MkKernel-setup-f
    \noop END-MkKernel-setup-f

    }


    regexp -line -start 0 "^(.*BEGIN-MkKernel-setup-f)(?:\\s.*)?$" $txtS allS prefixS

    puts "allS<$allS>"
    puts ""
    puts "prefixS<$prefixS>"

    exit

    # ------------------------------------------------------------------
    #
    # allS !! include !! newline
    #
    #
    # allS<\noop BEGIN-MkKernel-setup-f
    # \noop END-MkKernel-setup-f>
    #
    # prefixS<\noop BEGIN-MkKernel-setup-f>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to All on Fri Feb 16 13:16:08 2024
    Hi,

    The core problem is the "\s" token which *include* the "\n" and bypass the "regexp -line ..." restriction

    there is also a "[[:blank:]]" which seems to be the "\s" - "\n" but who knows?

    I'm not really sure if it is smart to offer an "-line" option and than let the "regexp" decide to follow this
    *wanted* behavior.

    mfg ao

    On 16.02.24 12:42, aotto1968 wrote:

    Hi, after spend a couple of time to check some "unwanted" behavior I figure out that
    "regexp -line…" bypass the newline "\n" -line border !!

    mfg ao


    =========================================================================== #!/bin/env tclsh

    set txtS {

    \noop BEGIN-MkKernel-setup-f
    \noop END-MkKernel-setup-f

    }


    regexp -line -start 0 "^(.*BEGIN-MkKernel-setup-f)(?:\\s.*)?$" $txtS allS prefixS

    puts "allS<$allS>"
    puts ""
    puts "prefixS<$prefixS>"

    exit

    # ------------------------------------------------------------------
    #
    # allS !! include !! newline
    #
    #
    # allS<\noop BEGIN-MkKernel-setup-f
    # \noop END-MkKernel-setup-f>
    #
    # prefixS<\noop BEGIN-MkKernel-setup-f>


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Fri Feb 16 17:42:14 2024
    * aotto1968 <aotto1968@t-online.de>
    | there is also a "[[:blank:]]" which seems to be the "\s" - "\n" but who knows?

    man re_syntax:

    blank A space or tab character.

    space A character producing white space in displayed text.

    \s [[:space:]]


    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to Ralf Fassel on Fri Feb 16 18:52:14 2024
    → what is you message? → the man page I already read.

    On 16.02.24 17:42, Ralf Fassel wrote:
    * aotto1968 <aotto1968@t-online.de>
    | there is also a "[[:blank:]]" which seems to be the "\s" - "\n" but who knows?

    man re_syntax:

    blank A space or tab character.

    space A character producing white space in displayed text.

    \s [[:space:]]


    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Fri Feb 16 19:00:26 2024
    * aotto1968 <aotto1968@t-online.de>
    | → what is you message? → the man page I already read.

    | On 16.02.24 17:42, Ralf Fassel wrote:
    | > * aotto1968 <aotto1968@t-online.de>
    | > | there is also a "[[:blank:]]" which seems to be the "\s" - "\n" but who knows?
    | > man re_syntax:
    | > blank A space or tab character.
    | > space A character producing white space in displayed text.
    | > \s [[:space:]]

    I was referring to your question "which seems to be...but who knows?".

    The manpage answers that question: [[:blank:]] is a space (0x20) or a
    tab (0x09), whereas [[:space:]] is anything which produces whitespace in
    text, so "[[:blank:]]" is not necessarily "[[:space:]] without \n" (as
    which I read "\s" - "\n").

    R'

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