Wednesday, March 25, 2026

Re: pattern syntax for match()


tim / christian

thank you.  both forms work as expected:  single and double quoted forms.  in all of my quoting permutations, i had been escaping the bar, also.

works fine, now.  many thanks.


On March 25, 2026 12:41:15 PM PDT, Christian Brabandt <cblists@256bit.org> wrote:

On Mi, 25 Mär 2026, Tim Chase wrote:

On 2026-03-25 12:01, S. Cowles wrote:
i would like to do the following operation:
let m = match( "foo" , "foo\|beep" )
however, i get no match. (m is (-1).)
what is the correct pattern syntax to enable this match?

Because they're strings, do you need to escape the "\", making it

let m = match( "foo" , "foo\\|beep" )

Or a bit more readable, use single quotes instead.

Thanks,
Christian
--
scowles@sonic.net
+1 510 380 8661

No comments: