简体   繁体   English

正常表达式“字符串不为空”

[英]Regular Expression for “string not empty”

Need some help to write a regex that catches this 需要一些帮助来编写一个捕获这个的正则表达式

/applicant-resume-upload?tfa_3352=ANYCHARACTERS

but not this 但不是这个

/applicant-resume-upload?tfa_3352=

(blank instead of any characters for the value). (空白而不是值的任何字符)。

\/applicant-resume-upload\?tfa_3352=(?!$|\s+).*

This should do it.It will ensure that it is not the end of line or space or newlines.. 这应该这样做。它将确保它不是行尾或空格或换行符。

See demo. 见演示。

http://regex101.com/r/sU3fA2/48 http://regex101.com/r/sU3fA2/48

Based on some of your other comments it sounds like you can't use lookarounds? 基于你的一些其他评论听起来你不能使用外观? I'm pretty sure most javascript engines have at least partial support for them, but if that's not the case for you then this pattern should work. 我很确定大多数javascript引擎至少部分支持它们,但如果你不是这种情况,那么这个模式应该可行。

\/applicant-resume-upload\?tfa_3352=.+

Or if you need to exclude white space then this 或者,如果您需要排除空格,那么这个

\/applicant-resume-upload\?tfa_3352=\S+

http://regex101.com/r/kH2xX7/1 http://regex101.com/r/kH2xX7/1

don't understand you want blank or not. 不明白你想要空白。

no blank: 没空白:

\/applicant-resume-upload\?\w+=\S+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM