R
regis
Greetings,
about scanf matching nonempty sequences using the "%[" specifier...
"%[^-]" matches a nonempty sequence of anything except '-'
"%[^[]" matches a nonempty sequence of anything except '['
"%[^]]" matches a nonempty sequence of anything except ']'
"%[^^]" matches a nonempty sequence of anything except '^'
"%[-]" matches a nonempty sequence of '-'
"%[[]" matches a nonempty sequence of '['
"%[]]" matches a nonempty sequence of ']'
....but how to match a nonempty sequence of '^' ?
"%[^]" is not possible because here ']' is not the closing bracket
but a character in the inverted scanset.
Assuming that '^' is 0136 in octal, then "%[\136" still has the
meaning "%[^" with '^' interpreted as a special character,
so this is not possible either.
"%[^-^]" is not interpreted as matching a nonempty sequence in the
degenerated range {'^', ..., '^'} but as matching anything
except '^' and '-'.
"\^" is non a valid escape sequence...
is there a solution ?
about scanf matching nonempty sequences using the "%[" specifier...
"%[^-]" matches a nonempty sequence of anything except '-'
"%[^[]" matches a nonempty sequence of anything except '['
"%[^]]" matches a nonempty sequence of anything except ']'
"%[^^]" matches a nonempty sequence of anything except '^'
"%[-]" matches a nonempty sequence of '-'
"%[[]" matches a nonempty sequence of '['
"%[]]" matches a nonempty sequence of ']'
....but how to match a nonempty sequence of '^' ?
"%[^]" is not possible because here ']' is not the closing bracket
but a character in the inverted scanset.
Assuming that '^' is 0136 in octal, then "%[\136" still has the
meaning "%[^" with '^' interpreted as a special character,
so this is not possible either.
"%[^-^]" is not interpreted as matching a nonempty sequence in the
degenerated range {'^', ..., '^'} but as matching anything
except '^' and '-'.
"\^" is non a valid escape sequence...
is there a solution ?