I have the following bit of code:
if ($i =~ m/[ -~]/) { $rhs .= $i; } else { $rhs .= "."; }
When I run it through a loop processing a string like "hello\nthere" it prints the following:
hello there
rather than
as I would except.hello.there
I thought that the regex -~ would result in the range of ASCII characters from a space (ascii 32) through the tilde (ascii 126). A newline is ascii 10 so I thought I should get a "." for the newline.
Anyone have any thoughts on this?
In reply to regex incorrectly matching newline by bfdi533
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |