C#: Compare a Regex string with groups -


i have string: {test1}-{test2}/{x+y}

i want check whether {test1}{test} matches string.

it match if ignore chars between }...{

how write regex?

update:

i want check whether {test1}{test2}{x+y} matches string:

{test1}-{test2}/{x+y}

i assuming comment means want use following pattern {test1}{test2}{x+y} , want match first string, additional rule between braced groups can provide anything, minus , division there should not prevent match.

to match input, can contain arbitrary characters between braced groups, use type of regular expression:

\{test1\}.*\{test2\}.*\{x\+y\} 

this match:

{test1}{test2}{x+y} {test1}-{test2}/{x+y}  {test1}+{test3}*{test2}/{test4}-{x-y}+{x+y}        ---------       ---------------           <-- parts match .* 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -