I am tryin to figure out how to find first occurence of specified character (lets say =) in string. This is easy, but i want position of that = only if its NOT in quotes.
For example, in this case:
foo = bar
I want position of first =, but in this case:
"foo = bar" = baz
I want position of the second =.
I found similar question here, but I need position, not splitting. And I must be able to deal with escaped quotes \" or \' so I think I wont be able to use string based approach to this problem.
One of my ideas was using lex. analysis with regexp based syntax analysis, which can find first occurence of = for me, but it seems rather heavy :)