notepad++

How to replace a string while while keeping a part of it using regex in Notepad++

五迷三道 提交于 2019-12-20 05:34:07
问题 I have file with multiple records: for example: "datetime": "2018-10-10" "datetime": "2018-10-11" "datetime": "2019-01-11" "datetime": "2018-02-15" I would like to replace this string such that i can retain the date values, so something of this sort: "datetime": date("2018-10-10") "datetime": date("2018-10-11") "datetime": date("2019-01-11") "datetime": date("2018-02-15") I am able to use "datetime": ".*" to find the above records, but am stuck with replacing them in the above format help is

How to delete nonconsecutive lines in text using RegEx?

廉价感情. 提交于 2019-12-20 05:18:14
问题 I use the following expression in Notepad++ to delete duplicate lines: ^(.*)(\r?\n\1)+$ The problems are: It is only for single word lines, if there is space in a line it won't work. It is only for consecutive duplicate lines. Is there a solution (preferably regular expression or macro) to delete duplicate lines in a text that contains space, and that are nonconsecutive? 回答1: Since no one is interested, I will post what I think you need. delete duplicate lines in a text that contains space,

Notepad++ Regex Find/Replace Using Look Behind not Working

允我心安 提交于 2019-12-20 04:59:36
问题 I have the following CSS markup. .previous-container{ float:left; } .primary-commands { float:right; } Using the regex syntax search (?<=[\s,;])([a-zA-Z\-]+): it highlights the CSS property name as expected, however, upon clicking replace nothing is replaced. I have tried using group token syntax in replace line e.g. $[nth group] and any plain literal string replacement. No matter my attempts it will not replace the matched string with anything. I am using notepad++ version 6.7.5. Perhaps

Highlighting regex capture groups in notepad++?

谁说胖子不能爱 提交于 2019-12-20 04:22:16
问题 As of now if I do a regex 'find and replace' in notepad++ it highlights the entire search parameter like a normal text 'find'. Would it be possible to have it highlight capture groups in a different color so I can easily identify what I'm capturing in regex? For example, if I wanted to match: print 'foo.' But capture foo for a replace string, with ^print '(\w+).'$ It would highlight the entire line in grey. I'd like it to highlight it all in grey, but highlight foo in red, for example, to

Line breaks using dlmcell in Matlab - shows up in Notepad++ but not Notepad

冷暖自知 提交于 2019-12-20 04:21:18
问题 I am using the function dlmcell in Matlab to output text. I want text on a new line each time I append using dlmcell. When I open my written document in Notepad++, each snippet of text is on a new line as I want it. However, opening it in Notepad that comes with windows, everything is on the same line. Can somebody tell me why this is, and how to fix it? 回答1: I'm assuming you're using the string \n to declare a new line in your output. For Notepad++ this is sufficient, because it interprets a

Notepad++ RegEx replace with Zerofill

隐身守侯 提交于 2019-12-20 04:12:50
问题 I need to replace a list like this: 105164 25 105164 26 105164 29 105496 1 105496 2 To 105164_0025 105164_0026 105164_0029 105496_0001 105496_0002 Something like (\w)([0-9]+) to _$1 but how to do the left zero padding? 回答1: [ ]([0-9]+) to _$1 --do your first replace _([0-9])$ to _000$1 _([0-9][0-9])$ to _00$1 _([0-9][0-9][0-9])$ to _0$1 Kind of a cheat method but that's the only way I can think of. 回答2: You can do in two passes: first pass: Find what: (\d+)$ Replace with: _0000$1 second pass:

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

空扰寡人 提交于 2019-12-20 02:54:16
问题 I have a string in this kind: SELECT column_name FROM table_name WHERE column_name IN ('A' , 'stu' ,'Meyer', ....); I want replace all characters in notepad++ from upper to lower (or vice versa) BUT, exclude from replacement, characters inside single quotation marks. condition: It exists no solid structure before/behind the single quotation marks part! (That means - I can not use the keyword "IN" or signs like "," or "(" or ")" or ";" for this regex ...!) target string (the characters inside

How do get my script file to console via Notepad++ external command?

百般思念 提交于 2019-12-20 01:42:08
问题 I am using Notepad++ for creating scripts and opening my active files from menu "Run" -> "Open current dir cmd". This works fine and the result is: c:\scripts> What I would like to have is the filename that I am working on currently so that I could try testing it right away. In my scripts I use parameters to define input and output files. Therefore the script shouldn't be run while opening, rather to have the script typed into console: c:\scripts>edit_text.pl I would then add manually the

Regex find instance of dash, but not <space>dash<space>

假如想象 提交于 2019-12-20 01:13:08
问题 I am sooo close. I am trying code a regex expression for Notepad++ to replace a dash with a space, ignoring dashes already with a pre/post space. I realize I could search/replace " - " with "foobarfoo" then search for "-" replacing for " " then converting "foobarfoo" back to " - ", but damnit - I'm trying to learn regex! Here's my problem: Adapter - BNC Male to BNC-Female, Right Angle to Adapter - BNC Male to BNC Female, Right Angle (note the disappearing dash in "BNC Female") The closest I

Regex in Notepad++ : How to get last part of URLs?

瘦欲@ 提交于 2019-12-19 13:46:06
问题 I have some URL like this: http://www.mywebsite.com/at/hello-everybody-mn0000000003 http://www.mywebsite.com/am/I-dont-care-mw0000322930 http://www.mywebsite.com/ccc/mood/I-love-you-d5207 How to get the last part which removed the last word? hello-everybody I-dont-care I-love-you 回答1: You could use the below lookahead based regex. [^\/]+?(?=-[^-\/]+$) DEMO 回答2: hope it can help you! $str = 'http://www.mywebsite.com/at/hello-everybody-mn0000000003'; $str = preg_replace('@http://www.mywebsite