由于空白太多,正则表达式无法正常工作 [英] Regex don't work due to too much white space
问题描述
目标:
无论使用多少白色或任何应该选择的字母,都要使用正则表达式。
问题:
如果我在"test">"之间的空间减少了。和"测试测试"正则表达式代码有效,但如果我在"test">"之间有更多空格。和"测试测试"比正则表达式代码不起作用。
我错过了那部分代码?
谢谢!
Goal:
Using working regex no matter what how much white or any letters that should be selected.
Problem:
WHen I have less space between "test">" and "testtest" the the regex code works but if I have more space between "test">" and "testtest" than the regex code doesn't work.
That part of the code am I missing?
Thank you!
(?<=<p class="listing__address">)(.+?)(?=</span><span class="listing__map-link">)
工具我用于互联网上的正则表达式。
http://regexstorm.net/tester
更少的空间:
$
Tool That am I using for regex in Internet.
http://regexstorm.net/tester
Less space:
<p class="listing__address"> <a onclick="LogAction('9875', 'Map')" href="https://asdf test"> testtest, <span>5252 Søreidgrend </span><span class="listing__map-link">lkjlkj</span></a></p>
更多空间:
More space:
<p class="listing__address"> <a onclick="LogAction('9875', 'Map')" href="https://asdf test">
testtest, <span>5252 Søreidgrend </span><span class="listing__map-link">lkjlkj</span></a></p>
推荐答案
尝试指定"单行"选项。在C#中,它是
RegexOptions.Singleline 。
这篇关于由于空白太多,正则表达式无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!