简体   繁体   中英

C++: Parsing patterned string, probably by Regular Expression

I have a string in the below format and want to parse this one and do some string manipulations with it and return back the result or throw back an exception. ALL C++.

Below is the format of the string to be parsed

" AND LIKE "" AND LIKE "" AND so on..."

I was thinking of going in for something like Regular Expression which can handle this. But, i am a naive in this area.

Any ideas from you geniuses would be great.

Below is an sample query and the expected output:

Strvalue = " 1=1 AND fSPRNumber LIKE "%"12"%" AND rRequestedFor.rOrganization.fName LIKE "%"abcd"%""

Expected: All the values within the double quotes, after the LIKE, to be extracted and then processed. Eg: "%"12"%" "%"abcd"%""

I should be able to do this for any number of AND and/or LIKE clauses in the query.

Also, suggest if there is simpler way of doing it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM