Implement an algorithm to validate whether a given string of system configuration parameters contains matching and correctly nested brackets.