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

Time:09-15

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-"'

CodePudding user response:

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

CodePudding user response:

I think one of the possible solutions would be

\"([^\-\^ ] )\"

https://regex101.com/r/ZHF3nB/1

  • Related