How does one write a regular expression in java that will match all strings without the character code zero?
I've tried:
Pattern.compile ("[^\0]");
and
Pattern.compile ("[^\u0000]");
Thanks.
Your first regex is almost right, but it only matches a single character that is not \0
. Try changing it to:
Pattern.compile ("[^\0]+");
This should match one-or-more (+
) characters that are not \0
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With