I have the following search phrase and I need to extract
- ABC XYZ
- Mobile Accessories
- Samsung 250
whenever they occur in the string in any order. The application is C# .Net.
Search Phrase
__________________________________________________________
ABC XYZ
ABC XYZ category:"Mobile Accessories"
category:"Mobile Accessories" ABC XYZ
ABC XYZ Model:"Samsung 250"
Model:"Samsung 250" ABC XYZ
ABC XYZ category:"Mobile Accessories" Model:"Samsung 250"
Model:"Samsung 250" category:"Mobile Accessories" ABC XYZ
category:"Mobile Accessories" Model:"Samsung 250" ABC XYZ
__________________________________________________________
Thanks in advance.
Example 1 Input - ABC XYZ category:"Mobile Accessories" Output - ABC XYZ and Mobile Accessories
Example 2 Input - Model:"Samsung 250" category:"Mobile Accessories" ABC XYZ Output - Samsung 250, Mobile Accessories and ABC XYZ
Example 3 Input - ABC XYZ Output - ABC XYZ
Example 4 Input - Model:"Samsung 250" ABC XYZ Output - Samsung 250 and ABC XYZ
If you're literally trying to find explicit strings, the IndexOf method will work for you (EG: s.IndexOf("ABC XYZ")).
The syntax you show looks kind of like a field:"value" syntax though, so perhaps you want a regex like "([a-z]+):\"([^"]+)\"" (Which should match out field and value in pairs).
If that's not what you're after sorry, but the question is a bit vague.