I have a string like “@1234@ == val1 && @2312@ != val2”. I want to get 1234 and 2312 which are embedded using ‘@’ separated into an array. The string can contain more than one items embedded using ‘@’.
update: will contain only integer values between ‘@’.
update2:valid input string which can occur are “@some int value@ == val1” or similar kind of string separated with ‘&&’ or ‘||’
sample input strings:
"@234@ == val1",
"@3456@ == 345 && @34563@ != 'Y'",
"@1234@ != val1 || @1234@ != val2 || @1234@ != val3"
what is the best way to achieve this?
Another way using LINQ:
In case your input like:
You can use this below Linq: