正则表达式:不包含某些指定的单词(超级难的正则式,前无古人哦)

正则表达式 不包含特定单词 字符串 项目中输入框需要验证不能输入root或者admin,不区分大小写。 琢磨了很久,写出来了正则如下: /^(?!root|admin)|\broot.+|\badmin.+/i tips:如果是写在java里,\b前面需要加转义符,写成\\b 如果你觉得有用,下载一下帮忙赚个积分,谢谢! 立即下载

找了N多的,正则式都没有结果。

最后借鉴了一个例子。

 

(?!单词).



这个是为了匹配某单词,无后缀。



然后用(?:)的循环语句廓上,循环0次,就搞定了这个超级难题。
(?:(?!单词).)*

 

最后结合实际情况的 urlRewriter.xml

当网页请求中非/shop下面的cart,order,intro,point,customer的时候,自动跳转到seasar2.org网站。

 

    <!--  LP Area -->
    <rule>
        <name>LP Area</name>
        <condition name="user-agent">Mozilla</condition>
        <from >^/shop/((?:(?!(cart|order|intro|point|customer)).)*)$</from>
        <to type="redirect" last="true">http://seasar2.org/shop/$1</to>
    </rule>

 

 

怎么样,看懂了没有,我也只是略懂而已。

Verilog实战:手把手教你实现四路组相联Cache(附完整代码解析) 本文提供了一份详细的Verilog实战指南,手把手教你实现一个四路组相联Cache。内容涵盖从设计规格、核心存储阵列、LRU替换策略到状态机设计的完整流程,并附有代码解析与优化技巧,旨在帮助硬件设计者掌握Cache控制器的RTL实现与调试方法。 阅读详情

相关推荐

VS2022 LNK1168无法打开进行写入 解决办法

C语言编程---VS---错误和警告---链接器工具错误---LNK1168--无法打开进行写入

weixin_67166415的博客 7171

正则表达式匹配不包含某个字符串(单词)的所有行

的这一行,把其他行都清空。我知道可以写 Java 代码,把 json 转换为对象,然后再提取出来。但是呢,感觉有些小题大做了。试着用 IntelliJ IDEA 的正则替换看能搞不,在网上查了一下,果然可以。如题,我的需求就是想用正则表达式匹配出,不包含某个字符串的所有行,我希望把匹配出的行都清空,只保留我想要的字符串。我有个 json 文本,里面有成百上千行,但是我只想保留含有。

1891

GQA数据集介绍

GQA,这是一个用于真实世界视觉推理和组合问答的新数据集。2200万个不同的推理问题,所有这些问题都带有表示其语义的功能程序。答案分布受到严格控制。11.3万张图像、2200万个问题,推理能力有对象和属性识别、传递关系跟踪、空间推理、逻辑推理和比较。

qq_56551150的博客 2964

正则表达式:不包含某些指定的单词

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33991727的博客 6944

告别同质化!用PyTorch Geometric手把手实现RGCN处理多关系图数据(附实战代码)

本文详细介绍了如何使用PyTorch Geometric实现关系图卷积网络(RGCN)处理多关系图数据,特别适用于社交网络分析、推荐系统等场景。通过实战代码演示了从数据加载、模型构建到训练优化的完整流程,帮助开发者高效处理异构图数据,提升模型性能。

weixin_30781433的博客 263

【Bug已解决】Failed to fetch version ECONNREFUSED 解决方案

方案适用场景推荐指数难度方案一:NODE_EXTRA_CA_CERTS代理/企业网关证书⭐⭐⭐⭐⭐低方案二:浏览器导出证书不知证书在哪⭐⭐⭐⭐中方案三:使用系统证书macOS 用户⭐⭐⭐⭐中方案四:关闭代理直连快速验证⭐⭐⭐低方案五:更新 Node.js证书列表过时⭐⭐⭐低方案六:同步系统时间时间偏差导致⭐⭐⭐低根本原因。

博客 9987

从CVSS 10.0漏洞应急到主动防御:实战解析高危漏洞攻防链

在网络安全领域,漏洞是攻击者入侵系统的主要入口。CVSS(通用漏洞评分系统)作为衡量漏洞严重程度的通用标尺,其评分机制从攻击向量、复杂度、权限要求及影响范围等多个维度评估风险。一个获得10.0满分的漏洞,通常意味着攻击者可远程、无需授权、利用复杂度低地实现远程代码执行(RCE)或系统完全接管,技术危害性极高。这类漏洞的利用价值在于,攻击者能快速构建从初始访问、权限提升到横向移动的完整攻击链路,最终达成数据窃取、勒索或持久控制等目标。在云原生与微服务架构下,核心组件(如Nginx、F5等)的此类高危漏洞,其影

weixin_33842304的博客 681

FortiWeb 相对路径遍历漏洞复现(CVE-2025-64446)

FortiWeb是Fortinet公司推出的企业级Web应用防火墙(WAF),专为保护Web应用和API抵御高级威胁设计。它集成人工智能与机器学习技术,通过双层检测引擎(HMM模型与SVM向量机)精准识别异常流量,可防御OWASP Top 10攻击、SQL 注入、XSS、DDoS及恶意机器人。其核心功能包括API自动化保护、虚拟补丁集成(兼容Acunetix等第三方扫描工具)及智能流量分析,支持HTTP/2、WebSocket等现代协议。(CVE-2025-64446)

iSee857的博客 470

正则表达式不包含指定字符

js正则1-32个字符;不能包含 '/ \ : * ? “< >

MYG_G 3087

道威棱镜的设计参考

道威棱镜的设计参考

weixin_72050316的博客 385

农业无人机:无人机图像处理_(8).遥感图像处理与分析

遥感图像处理与分析在农业无人机技术中具有重要作用,通过图像预处理、特征提取、分类与分割、目标检测等技术,可以实现对农田的精细管理、作物监测、病虫害预测等应用。本节详细介绍了这些技术的基本概念、常用方法和具体实现,希望对您在农业无人机图像处理方面的学习和应用有所帮助。

zhubeibei168的博客 1345

使用正则表达式去表示一串字符串不能出现某个单词

最近有个朋友问我一个正则怎么写 表达的意思是不能出现某个或者多个单词。abc是代表着任意的不想出现的单词,如果不想出现多个的话则可以。

nanshengabc的博客 771

R语言机器学习算法实战系列(十三)随机森林生存分析构建预后模型 (Random Survival Forest)

本教程运用随机森林生存分析筛选与患者生存状态显著相关特征。该方法借随机森林这一强大机器学习算法,构建多棵决策树并集成结果,以提高生存分析准确性,识别关键生物标志物。接着,利用选定特征构建风险得分,将多个特征转化为单一数值,量化患者风险水平。之后,依据风险得分将患者分为高、低风险亚型,为临床治疗提供个性化指导。最后,通过分析时间依赖的 ROC 曲线评估模型长期预测能力。此曲线计算不同阈值下的真正例率与假正例率,在多个时间点评估,全面展现模型长期稳定性与准确性。

专注生信领域 2040

使用正则表达式匹配不包含特定单词的行

在文本处理中,有时需要筛选出不包含特定单词的行。虽然可以通过其他工具(如grep -v)先匹配单词再反转匹配结果,但直接使用正则表达式来实现这一需求会更加高效和灵活。正则表达式在各种编程语言和文本处理工具中广泛应用,掌握其反向匹配的方法能提升文本处理的能力。

qq_29715355的博客 796

深度学习工具包 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")

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

正则表达式匹配:包含某单词且不包含某单词

正则表达式

guigenyi的专栏 693

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

正则表达式匹配不包含某些字符串的技巧

这篇文章主要介绍了正则表达式匹配不包含某些字符串的技巧,详细分解了应该怎么做和这么做的原因,需要的朋友可以参考下 经常我们会遇到想找出不包含某个字符串的文本,程序员最容易想到的是在正则表达式里使用,^(hede)来过滤”hede”字串,但这种写法是错误的。我们可以这样写:[^hede],但这样的正则表达式完全是另外一个意思,它的意思是字符串里不能包含‘h',‘e',‘d'三个但字符。

FantasyWind-奇风的悟道之地 1万+

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

使用正则表达式找出不包含特定字符串的条目

概述 做日志分析工作的经常需要跟成千上万的日志条目打交道,为了在庞大的数据量中找到特定模式的数据,常常需要编写很多复杂的正则表达式。例如枚举出日志文件中不包含某个特定字符串的条目,找出不以某个特定字符串打头的条目,等等。 使用否定式前瞻 正则表达式中有前瞻(Lookahead)和后顾(Lookbehind)的概念,这两个术语非常形象的描述了正则引擎的匹配行为。需要注意一点,正则表达式钟的前和...

小河过马 682

正则表达式中的不包含一个词的写法

<br />/b((?!abc)/w)+/b

JUST DO IT. 2500

正则表达式 不匹配某个单词

如果文本存在某敏感词如 porn,则认为不合法。 以这个单词pron为例: (?!porn). 表示非 porn 的任意元素 ((?!porn).)* 表示非 porn 的任意元素可以 >=0 次出现。 ^(((?!porn).)*)$ 表示从头至尾,必须非 porn 的元素才能 >= 0 次出现。 ^(((?![P|p][O|o][r|R][N|n]).)*)$ 表示不能出现 porn 这个单词,无论其字母大小写 本文来源如下 作者:智勇双全的小六 链接:https://www.jians

qq_36234441的博客 5160

Java正则表达式:排除单词/字符串

如果要在搜索模式中排除某个单词/字符串,那么执行此操作的一种好方法是正则表达式断言函数。如果您要匹配不跟随其他东西的东西,这是必不可少的。 一个简单的例子 String str = “programcreek”; Pattern p = Pattern.compile(".program(?=creek)."); Matcher m = p.matcher(str); if(m.matches()...

阿志同学 2269

正则表达式,匹配非某字符或单词

在正则表达式中,想不匹配某

ATCO[这里,只是顺手插曲] 3万+

正则表达式:从句子中找出包含或不包含特定内容的单词

这个弄了很久,其实特简单,但思路很容易被绕,分析过程不多说了,直接上demo。   This is a dictionary. 找出其中包含"is"的所有单词。 var reg = /\b[\w]*is[\w]*\b/g; var result = "This is a dictionary.".match(reg); for(var i=0; i&lt;result.length;i...

天涯书塾 2428

正则表达式 匹配不包含指定字符串的方法

正则表达式 匹配不包含指定字符串的方法,(?!a)来表示我们是否需要匹配某个东西

stwood007的博客 2万+
上一篇: PHPMailer v2.0.0 新知
thefirstwind
博客等级 码龄25年 213粉丝 55原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值