Tokenize a string in C# which delimeters contains some parts of other delimeters -


i want tokenize string using regular expressions based on operators. operators inlude others string. such as

>= , >, [ eg. >= contains >]

suppose have string

(3>=4)!=(3>4) [ operators >= , != , >]

how tokenize correctly?

is there reason have regular expressions? would easier if used string split function on it. if start complex operators (>=) don't have worry later splitting on >.

edit: adding example below

//put operators in order of 'complexity'. since >= contains > , =, comes before them string[] operators = new string[] {">=", "!=", ">", "="}; string expression = "(3>=4)!=(3>4)";  foreach (string operator in operators) {     //perform logic of creating expression tree here } 

so basically, inside loop it's going break down expression. you'll need construct expression tree inside here based on order of operations.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -