这是我提出的,但它只选择了演示文本中的一些li元素
<li>(.+?)</li>
演示文字
<li><div class="tech-question">What is the most important feature of Java?</div><div class="tech-answer">Java is a platform independent language.</div></li>
<li><div class="tech-question">What do you mean by platform independence?</div><div class="tech-answer">Platform independence means that we can write and compile the java code in one
platform (eg Windows) and can execute the class in any other supported platform
eg (Linux,Solaris,etc).</div></li><li><div class="tech-question">What is a JVM?</div><div class="tech-answer">JVM is Java Virtual Machine which is a run time environment for the compiled
java class files.</div></li><li><div class="tech-question">Are JVM's platform independent?</div><div class="tech-answer">JVM's are not platform independent. JVM's are platform specific run time
implementation provided by the vendor.</div></li><li><div class="tech-question">What is the difference between a JDK and a JVM?</div><div class="tech-answer">JDK is Java Development Kit which is for development purpose and it includes execution environment also. But JVM is purely a run time environment and hence you will not be able to compile your source files using a JVM.</div></li><li><div class="tech-question">What is a pointer and does Java support pointers?</div><div class="tech-answer">Pointer is a reference handle to a memory location. Improper handling of
pointers leads to memory leaks and reliability issues hence Java doesn't
support the usage of pointers.</div></li>
答案 0 :(得分:0)
&#34;。&#34;赢了不匹配换行符或行终止符。所以如果它像Michal M所说的那样在另一条线上结束,那么它就会被剪掉。
你可以尝试
<li>(.*)</li>
哪个匹配任何包含零次或多次&#34;。&#34;
的字符串答案 1 :(得分:0)
由于Tushar和MichałM建议我错过了新线。
Tushar的建议按预期工作
<li>([\s\S]*?)<\/li>