Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

40 views
Skip to first unread message

aotto1968

unread,
Feb 16, 2024, 6:42:29 AMFeb 16
to

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>

aotto1968

unread,
Feb 16, 2024, 7:16:13 AMFeb 16
to

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

Ralf Fassel

unread,
Feb 16, 2024, 11:42:19 AMFeb 16
to
* aotto1968 <aott...@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'

aotto1968

unread,
Feb 16, 2024, 12:52:18 PMFeb 16
to
→ what is you message? → the man page I already read.

Ralf Fassel

unread,
Feb 16, 2024, 1:00:31 PMFeb 16
to
* aotto1968 <aott...@t-online.de>
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'
0 new messages