Hi, On Sat, Oct 24, 2020 at 8:15 AM Jason Franklin <[email protected]> wrote:
> Greetings: > > I have discovered that the pattern matching in try/catch blocks does not > conform to my expectations. > > Try this example: > > try > echoerr 'foo bar baz' > catch /foo/ > echo 'caught' > endtry > > The string "caught" is printed, as I would expect. > > Now try this: > > try > echoerr 'foo bar baz' > catch /^foo/ > echo 'caught' > endtry > > You will see that the message was NOT caught. It appears that using the > "^" metacharacter here causes the message not to match. > > Can anyone else confirm this? Is this a bug? > > It definitely surprised me. > > The exception that is thrown is "Vim(echoerr):foo bar baz". So if you want to match the beginning of the exception string, then you need to use /^Vim(echoerr):foo/ - Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7np3u%3D8SqdnruAiei6kwnrZHJEeS1tH%3DnkzzU_Wau3qDw%40mail.gmail.com.
