I want to match characters other than those enclosed in parentheses []
, but I don't know.
Aiueo [Dark] Kakikukeko [Fuga]
↓ String to match
Aiueo
Kakikakeko
I think you can do it if you use the look ahead.
If the part (A) to be matched is [^\[\]]+
, and the part (B) not to be matched is \[^\[\]+\]
, then the way to look ahead is A(?=B), that is, [^\[\]+(?=\[^\[[\[\]]+\])
.If you combine this with the pattern A$=[^\[\]]+$
that matches the end (or the whole)
([^\[\]]+(?=\[[^\[\]]+\])|[^\[\]]+$)
will be
↓ String to match
Oh, my God. Kakikakeko
If you want to match only these two patterns, simply
(Aye-ye-ye-ye-ye-ye-ye-ye-ye-ye-ye-ye
is acceptable (for POSIX regular expressions).
Regular expressions may vary slightly depending on the language, so
If possible, please specify the programming language you want to use when you ask questions.
would be a good idea.
"Ho"
"Gee"
"Huh"
is "
if you wish to exclude
[^Blowing] +
The specific match and mismatch conditions are not clear in the question, so
I think it's very difficult to answer.
© 2024 OneMinuteCode. All rights reserved.