notepad++之正则表达式的使用

Notepad++正则查询替换操作 Notepad++编辑器查找功能非常强大,本处记录一些实战中常用到复杂查询替换操作。注意:如果是重要文件,替换操作前最好备份;当前一个操作后也可以用ctrl+z恢复。 阅读详情

notepad++是windows系统上经常使用的文本编辑工具,同时还支持正则表达式的使用,本篇文章讲一下正则表达式在notepad++中的常用案例。

常用工具系列 相关文章:

Windows平台 常用开发工具下载

  • putty,Android Studio,Visual Studio Code,git,Visual Paradigm社区版,WinRAR,Everything

Ubuntu平台 常用工具下载

  • 截图软件(flameshot),远程Windows桌面软件(freerdp),Android相关工具(adb、scrcpy),图形化磁盘查看工具(GParted),时序图,类图等绘制软件(Visual Paradigm社区版),python开发工具(PyCharm),文本对比工具(Beyond Compare 4),屏幕录制gif工具(peek),远程访问windows共享目录(mount.cifs),终端工具terminator。

Ubuntu平台 常用插件下载(部分含源码)

  • openssh,net-tools,openssl 源码下载,openjdk 源码下载,oracle jdk

Visual Studio Code讲解(一) 安装及常规配置

Visual Studio Code讲解(二) ssh远程操作电脑

Visual Paradigm创建UML的流程和一点实用技巧

notepad++之正则表达式的使用

1. 找到某特征的字符串

比如找到下面黑框中的内容
在这里插入图片描述

正则表达式:

查找目标: filename.*label\=\"[^ ]*
符号含义
.代表除换行符外的任意字符
*代表匹配零次或者多次
\这个就是转义字符,匹配符号的时候在符号前面加上这个
[^ ]匹配非单个空格,和*组合一起就代表匹配零个或者多个非空格字符串

在这里插入图片描述


2. 替换案例1中的字符串以外的内容为空

正则表达式:

查找目标: .*(filename.*label\=\"[^ ]*).*
  替换为: \1

只要将案例1中的字符串加上小括号,然后在前边和后边分别加上.*即可。代表查找包含案例1中特征字符串的整行。
\1代表查找目标中小括号括起来的内容,如果有多个目标,可以再写\2,\3等等。
在这里插入图片描述


3. 在案例1的特征基础上,不查找filename为空的字符串

也就是说不匹配""这样的字符串,但是[^]这种表达式只能匹配单独字符,如果写了字符串,也会把字符串拆开单独匹配。那么如何匹配非某字符串这种形式呢?答案是零宽负向先行断言(?!pattern) 或者零宽负向后行断言(?<!pattern) 。

正则表达式:

查找目标: filename=(?!"").* label=[^ ]*

这里注意一下,(?!“”)后面要加.*,代表.*中不匹配“”。

在这里插入图片描述

Notepad++ 使用正则表达式匹配的方法 这篇文章主要介绍了Notepad++ 使用正则表达式匹配的相关资料,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下。 阅读详情

相关推荐

如何用Python+Librosa实现轴承异响检测?5步搞定工业设备故障预警

本文详细介绍了如何利用Python和Librosa库,通过5个步骤构建工业轴承异响检测与故障预警系统。从音频采集、预处理、频谱特征提取,到构建机器学习模型并进行实时监测,提供了完整的代码级解决方案。该方法能有效识别轴承早期故障特征,实现低成本、高效的设备预测性维护。

rnn9storyteller的博客 634

notepad++中使用正则表达式

正则表达式

lyd0813的博客 8500

DEMATEL-ISM模型的Python实现——方法介绍以及代码复现

本文参考文献与网络资料,对DEMATEL-ISM方法做了介绍何步骤描述,并给出Python代码进行了计算和绘图。

cros1的博客 2万+

Notepad++正则匹配

KaTeX parse error: Undefined control sequence: \n at position 3: \r\̲n̲,而不是\r\n。Notepad++正则表达式字符串最长不能超过69个字符。Note: 以换行符结尾表示是。

tttzzzqqq2018的博客 8057

从STM32转战STC32G?逐飞开源库帮你快速上手GPIO、PWM与ADC(避坑指南)

本文详细介绍了从STM32迁移到STC32G32K128的开发实践,重点解析了GPIO、PWM和ADC等基础外设的设计差异,并提供了基于逐飞开源库的高效应用方案。通过对比两种平台的开发工具和操作方式,帮助开发者快速上手STC32G,避免常见陷阱,提升开发效率。

weixin_30316097的博客 532

innovus:InstPad、CellPad 、module padding、clock cell halo

我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?site_num指的是padding的大小以site宽度为单位。

m0_61544122的博客 2029

Notepad++ 使用正则表达式匹配

Notepad++ 如何使用正则表达式进行高效匹配。

weixin_44259499的博客 1万+

PyTorch实战(2)——使用PyTorch构建神经网络

在本节中,我们使用 PyTorch 在简单数据集上构建了一个神经网络,训练神经网络来映射输入和输出,并通过执行反向传播来更新权重值以最小化损失值,并利用 Sequential 类简化网络构建过程;介绍了获取网络中间值的常用方法,以及如何使用 save、load 方法保存和加载模型,以避免再次训练模型。

盼小辉丶的博客 1万+

Notepad++ 使用正则表达式

最近在写论文,使用notepad++处理一些文本数据,想要匹配一些特定的汉字,但是人工去看太麻烦了,于是想到了用正则表达式。notepad++中正则表达式的语法如下:\ 转义字符 如:要使用 “\” 本身, 则应该使用“\”\t Tab制表符 注:扩展和正则表达式都支持\r 回车符CR 注:扩展支持,正则表达式不支持\n 换行符LF 注:扩展支持,正则表达式不支持. 匹配任意

季诗筱的博客 1万+

C# WPF上位机开发(利用tcp/ip网络访问plc)

【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】 c# wpf如果是用来开发非标上位机的,那么和plc的通信肯定是少不了的。而且,大部分plc都支持modbus协议,所以这个时候如果有一个库可以帮助我们和plc设备进行modbus通信,那就非常方便的。目前NuGet下关于modbus的函数库还是有一些的,比如EasyModbus。

嵌入式-老费,一个分享专业嵌入式知识的blog 2530

8、内存交织技术详解

本文详细解析了内存交织技术的基本原理、工作机制及实现方式,探讨了其在提升内存访问速度和系统性能中的关键作用。文章还分析了内存交织的优缺点、实际应用场景以及与其他优化技术的结合应用,并提出了未来发展的可能方向,为理解与运用该技术提供了全面参考。

g9h0i1的博客 553

notepad++正则表达式使用

notepad++的正则表达式的使用

qq_37666344的博客 1086

qt open3dBPA重建

open3d BPA重建

阁楼 516

Notepad++正则表达式使用

推荐个正则表达式在线测试的工具http://ccmpp.com/Regex/Notepad++正则表达式使用 2011-01-06 10:01:35| 分类: 文档 | 标签:正则表达式 替换 notepad++ 匹配 查找 |举报|字号 订阅 使用正则表达式可以很好地完成很多繁琐耗时的工作,以下抄录editplus正则表...

anwenzhao0749的博客 843

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

使用Notepad++正则表达式轻松找到重复名字

通过以上步骤,我们可以在Notepad++中利用正则表达式快速找到重复的名字。根据具体需求,我们可以编写不同的正则表达式来匹配不同类型的重复。Notepad++的正则表达式功能可以帮助我们高效地处理大量文本数据,节省我们的时间和精力。

理论都是虚的,代码才是王道。 3882

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

notepad++ 正则表达式使用

notepad++ 正则表达式使用 .* 代表中间的任意字符。 参考 用notepad++的正则表达式来做搜索 NotePad++的查找的用法(包含正则表达式) 你真的会notepad++的搜索功能吗?(正则表达式)

lxw234lxw的博客 802

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【工具使用】Notepad++如何使用正则表达式同时搜索多个字符串

本文介绍如何使用NotePad++的正则表达式多个字符串的搜索,供参考。

专注音频,高效工作,快乐生活! 1万+

在Notepad++或Sublime中使用正则表达式替换

Notepad++的查找替换功能十分方便,一般情况下用基本的功能即可满足需求,但有时候替换的字符串比较复杂,就可能用到正则表达式替换,最近就遇到了一个这样的例子,场景可以简单抽象如下: move sourcefile1 destfile1 move sourcefile2 destfile2 move sourcefile3 destfile3 move sourcefile4 destf

chenpkai的博客 1114

notepad++在工作中使用正则表达式

1.前言 工作中时常会通过notepad++对数据进行处理,这里记录一下本人在工作中用到的,持续补充吧! 2.正则表达式在notepad++中的使用 1.贪婪模式与非贪婪模式 目标串:abb 贪婪模式匹配串:a.* ---结果:abb 非贪婪模式匹配串:a.? ---结果:ab 2.分组 正则表达式会保存每个分组的真正匹配的内容,分组的编号从左到右依次计数,从1开始 目标串:让等号右边都加上一个序号1 正则表达式执行如下:(.)(=.*) 括号包括的内容就是分组。我们要引用

浅时光|初如梦 2522

Notepad++使用正则表达式快速删除注释

Notepad++使用正则表达式快速删除注释:单行注释,多行注释,html注释。

weixin_48414266的博客 1388

正则表达式在notepad++中的使用

在看日志时发现不同等级的日志太多,需要进行过滤,notepad++支持正则表达式,故选用它 ^[(FATAL)|(WARNNING)].*支持查找FATAL和WARNNING。

Season@HangZhou 专栏 1462

Notepad++ 使用正则表达式查找替换字符串

  最近在改一些别人写的PHP代码,由于之前的代码可维护性比较差,因此工作量比较多,因此想找一些高效的方式改一些有规律的代码。 比如: 我想将一些类似$rowss[MaxGetCash_num],$rowss[modes_gifts_money],$rowss[Limit_Betting]等字符串,由于之前的程序员没有在索引两边加"",所以程序会报错。   我...

diankong6347的博客 324

Notepad++ 使用正则表达式清空所有中文汉字

Notepad++ 使用正则表达式清空所有中文汉字 首先,将Notepad++编码格式调整为UTF-8 然后将文本数据,粘贴进去 举例: 使用正则表达式 :[一-龥] 进行替换 在Unicode编码中汉字的编码范围为【\u4e00-\u9fa5】,对应的中文汉字为[一-龥] 替换结果: 注意事项: 使用该方法清除汉字时,需要将文本格式先设置为UTF...

python_go的博客 9099

在 Notepad++ 或 EditPlus 中使用正则表达式进行高级查找替换

在工作中适当地使用一些技巧,总可以让我们提高效率和准确率。在 Notepad++ 中使用正则表达式进行高级查找替换,对于一些批量性质的工作是很有帮助的。我们来看下面一个例子: 这是在剑南春项目中遇到的一个实际问题。要求是在数据库 MISC_SERIAL_QUEUE 表中写入一大批模拟序列号数据,大致为这样的形式: 01234567890000000001 0123456789000000...

weixin_30697239的博客 352

使用Notepad++的正则表达式更改字母大小写

使用Notepad++的正则表达式更改字母大小写

Alexabc3000的专栏 3934
上一篇: 整体文章导航
下一篇: Linux系列讲解 —— Ubuntu18.04安装gcc 9.1.0(C++17)
星际工程师
博客等级 码龄9年 1万+粉丝 57原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

星际工程师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值