Trying to create a pattern that matches an opening bracket and gets everything between it and the next space it encounters.
I thought \\[.*\\s
would achieve th
\[[^\s]*\s
The .*
is a greedy, and will eat everything, including spaces, until the last whitespace character. If you replace it with \S*
or [^\s]*
, it will match only a chunk of zero or more characters other than whitespace.
Masking the opening bracket might be needed. If you negate the \s with ^\s, the expression should eat everything except spaces, and then a space, which means up to the first space.