I want to validate this string "B3:D7,0 H3:J7,0 B9:L27,1 B29:L48,2 B50:L56,2" using pattern but it doesn't match. I don't know what error there is in the regex string.
I used pattern="[A-Z][0-99]+:[A-Z][0-99]+,[0-9]+" inside textfield in html
To match a digit 0-9 you can use [0-9] or \d
Assuming you don't want spaces at the start and at the end, you can repeat the pattern 1 or more times preceded by a space.
^[A-Z]\d+:[A-Z]\d+,\d+(?: [A-Z]\d+:[A-Z]\d+,\d+)+$
^ Start of string[A-Z]\d+:[A-Z]\d+,\d+ Match : between a char A-Z and 1+ digits followed by , and 1+ digits(?: [A-Z]\d+:[A-Z]\d+,\d+)+ Repeat 1+ times the same pattern with a space preceded.$ End of stringUsing the pattern attribute, you can omit the start and end anchors as they are already implied.
pattern="[A-Z]\d+:[A-Z]\d+,\d+(?: [A-Z]\d+:[A-Z]\d+,\d+)+"
Note that if you want to match a digit 1-99 you can use [1-9]\d?
^[A-Z]\d+:[A-Z]\d+,\d+(?: [A-Z]\d+:[A-Z]\d+,\d+)*$ with * as a quantifier for 0 or more times. See regex101.com/r/sMjQWJ/1
[0-99]is the same as[0-9].