Replace quotation marks only around matches which do not contain ^ or -

Viewed 38

I'm trying to build an expression which would replace quotation marks only from matches that don't include ^ or -

string = '"Q%LCJ8^1"+"Q%VOD.L"+"Q%LSEG.L[EQ_LIST]MID_PRICE"+"BRT-"'

result = '"Q%LCJ8^1"+Q%VOD.L+Q%LSEG.L[EQ_LIST]MID_PRICE+"BRT-"'

2 Answers

this regex "([^\^_+"]+)" finds in

the source-String

"Q%LCJ8^1"+"Q%VOD.L"+"Q%LSEG.L[EQ_LIST]MID_PRICE"+"BRT-"

"BRT-" and "Q%VOD.L"

not far from what expeced

expectedString = '"Q%LCJ8^1"+Q%VOD.L+Q%LSEG.L[EQ_LIST]MID_PRICE+"BRT-"'

now a programming language is needed.

the regEx you see also here https://regex101.com/r/z9ERGi/1

Related