I need to match (using regex) strings that can be like this:
required: custodian_{number 1 - 9}_{fieldType either txt or ssn} optional: _{fieldLength 1-999}
So for example: custodian_1_ssn_1 is valid custodian_1_ssn_1_255 is valid
custodian or custodian_ or custodian_1 or custodian_1_ or custodian_1_ssn or custodian_1_ssn_ or custodian_1_ssn_1_ are not valid
Currently I am working with this:
(?:custodian|signer)_[1-9]?[0-9]_(?:txt|ssn)_[1-9][0-9]?(_[1-9]?[0-9]?[0-9]?)?
as my regex and my api is working to pick up: custodian_1_txt_1 custodian_1_ssn_1 custodian_1_txt_1_255 <---- not matching the last "5"
any thoughts?
string.Split('_')and then iterate over the resulting array, checking for validity and required attributes.[1-9]?[0-9]would match 0-99. Why is the first digit optional, and why is there a second digit at all?