-2

I have this string This is a test -[[message]]- and I want to match -[[message]]-

This is my trying \w+$

How can I do that?

Taha Sami
  • 1,565
  • 1
  • 16
  • 43
  • Does this answer your question? [Learning Regular Expressions](https://stackoverflow.com/questions/4736/learning-regular-expressions) – jonrsharpe Nov 22 '21 at 07:45

1 Answers1

0

You can use \S, a negative character class matching any character that is not a whitespace character (such as space, tab, new line, etc.):

\S+
Chris Ruehlemann
  • 20,321
  • 4
  • 12
  • 34