I want to find the null characters in an array, which I have. I tried displaying the ASCII value and it printed 0 (So I am confirmed it is a null value). How do I write a regex to filter out those values.
I wrote :
m/^$/ig
which really didn't help me. Does anybody know how to match a null character ?
You can use \x
followed by the hex code of an ASCII character to match that ASCII character.
E.g. /\x3F/
will match a "?", /\x46\x4F\x4F/
to match "FOO".
See it here on Regexr
So /\x00/
would match the NULL character.
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