'''\[(.*?)\]''' ?-> when this char after(*, +, ?, {n}, {n,}, {n,m}), the match pattern is not greedy e.g.1 String: 512.16[3][b]] Pattern:'''\[(.*)\]''' This will match "[3][b]]" e.g.2 String: 512.16[3][b]] Pattern:'''\[(.*)?\]''' This will match "[3]" and "[b]"