regex - replace characters in notepad++ BUT exclude characters inside single quotation marks(2nd) -


replace characters in notepad++ exclude characters inside single quotation marks

sorry users (especially avinash raj) answered 1st similiar question - did forget 2nd kind of string. (and (that sad thing) - i'm not able adjust solution 1st similiar question 2nd kind of string...)

i have 2 different strings in kind:

select column_name table_name column_name in ('a' , 'st9u' ,'meyer', ....);    a.object_type in (' 'table'', ''mateerialized vie3w'   ') 

i want replace characters in notepad++ upper lower, exclude replacement characters inside single quotation marks.

condition: exists no solid structure before/behind/between single quotation marks part!

(that means - can not use keyword "in" or signs "," or "(" or ")" or ";" regex ...!)

the once thing is, 2 structures single quotation marks possible: 'word|number' or ''word|number'' (but, shown in 2nd example, different number of spaces between every single quotation mark!).

target string (the characters inside single quotation marks have stay unchangend):

select column_name table_name column_name in ('a' , 'st9u' ,'meyer', ....);    a.object_type in (' 'table'', ''materialized vie3w'   ') 

how can exclude in notepad++ single quotation marks part (from replacement)?

could combine recursive part getting '... '.... abc '' , use \k resetting after. part needs skipped. , using kind of the trick, matching remaining words in pipe:

'\s*(?0)?[^']*'\k|(\w+) 
  • (?0)? here pattern optionally pasted start
  • \s shorthand whitespace character [ \t\r\n\f]
  • \w short word character [a-za-z0-9_]

and replace \l\1 lower words captured inside first capture group or \u\1 upper.
works me in np++ 6.7.9.2 sample data. see regex101 testing pattern.

enter image description here


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -