Recently I came across a character range that was the following:
[/-+]
My very simple question is, is this even a valid character range? If so, what range of characters would it match?
Recently I came across a character range that was the following:
[/-+]
My very simple question is, is this even a valid character range? If so, what range of characters would it match?
It's not a correct range.. it would have to be [+-/] since + comes before / in the ASCII table.
Speaking of the ASCII table, the [+-/] would match +, ,, -, ., or /
Here's some test cases (JavaScript):
var r = /[+-\/]/;
r.test('foo'); // false
r.test('foo+'); // true
r.test('foo/'); // true
r.test('foo.'); // true
r.test('foo,'); // true
r.test('foo-'); // true