c# - Regex expression for string matching -
i need match string "*b*[xxx]". example "mb0[23]" or "db50.dbb152[128]". @ moment, it's complicated me.
please help.
if right example, format has contain capital b , brackets numbers in it. try use 1 of these:
this strings contain "b" , brackets after (with optional contents):
char c = convert.tochar(65535); string format = @"/(?:[\0-" + c + @"]+)?b(?:[\0-" + c + @"]+)?\[(?:[\0-" + c + @"]+)?\]/"; this strings contain "b" , brackets after numbers or nothing in it:
char c = convert.tochar(65535); string format = @"/(?:[\0-" + c + @"]+)?b(?:[\0-" + c + @"]+)?\[(?:\d+)?\]/"; this strings contain "b" , brackets after numbers in it:
char c = convert.tochar(65535); string format = @"/(?:[\0-" + c + @"]+)?b(?:[\0-" + c + @"]+)?\[(?:\d+)\]/"; this should match both examples provided. can check , learn format here: http://www.regexr.com/
Comments
Post a Comment