regex - Using powershell to delete the middle of a string -


i have text file contains text

data collate unknown null, or  data collate unknown not null, 

i need delete collate , unknown text file, i'm thinking -replace form of regex way go in way shape or form, can't figure out how keep null or not null.

also note every line in file not contain collate , unknown

i suppose unknown placeholder number of characters?

then try

$result = $subject -creplace 'data collate .*?((?:not )?null,)', 'data $1' 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -