简体   繁体   中英

Find and Replace Regular Expression (NotePad++)

I'm looking at a global search and replace within NotePad++ which will look for the following text...

date and %c

examples would be...

date +%m-%d%H:%M:%S%c
date +%m-%d%H%c:%M:%S
date +%c-%m-%d%H:%M:%S

etc.

I can find the string by searching for date (.)+%c but I can't think for the life of me what the replacement would be. I want to replace %c with %z (or something else later on) and keep the remaining text.

Thanks for any help.

You can search for

date (.*?)%c(.*)

and replace it by

date $1%z$2

Output for your examples:

date +%m-%d%H:%M:%S%z
date +%m-%d%H%z:%M:%S
date +%z-%m-%d%H:%M:%S
(date.*?)%c

替换为: $1%z

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