[英]Get word between two sets of characters
I'm trying to write a regular expression that takes any word between these two sets of characters: 我正在尝试编写一个正则表达式,该正则表达式在这两组字符之间使用任何单词:
3D
and &sa
3D
和&sa
examples : 例子 :
3D Evb31p5vFs4_
&sa : the output : Evb31p5vFs4_
3D
Evb31p5vFs4_
&sa :输出: Evb31p5vFs4_
3D _Ve8_LBztG50_
&sa : the output : _Ve8_LBztG50_
3D
_Ve8_LBztG50_
&sa :输出: _Ve8_LBztG50_
I have used the expression: /\\w[3D][A-Za-z0-9_-].*sa/g
我使用了表达式:/
/\\w[3D][A-Za-z0-9_-].*sa/g
So the next step is to skip the "3D" and "&sa" 因此,下一步是跳过“ 3D”和“&sa”
Thanks in advance! 提前致谢!
Try this: 尝试这个:
3D(?s)(.*)&sa
Explaination: 阐释:
3D matches the characters 3D literally (case sensitive)
(?s) Match the remainder of the pattern with the following options:
s modifier: single line. Dot matches newline characters
1st Capturing group (.*)
.* matches any character
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
&sa matches the characters &sa literally (case sensitive)
g modifier: global. All matches (don't return on first match)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.