屌霸虎学正则表达式的笔记

前端之家收集整理的这篇文章主要介绍了屌霸虎学正则表达式的笔记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

要这一段

正则是:

<a\shref="([^"]*\.pdf)">

结果就出来了

<a href="/uploads/2/1/0/0/21005170/instruction-3d-picture.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-picture-nativity.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-picture-visit-magi.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-03_jesus_visits_jerusalem_as_a_boy.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-04_when_jesus_was_baptized.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-05_nicodemus_visits_jesus.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-06_jesus_calls_his_first_disciples.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-07_jesus_and_the_woman_from_samaria.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-08_the_sermon_on_the_mount.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-09_jesus_healing_ministry.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-10_raising_of_lazarus.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-11_in_the_garden_of_gethsemane.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-12_truly_this_was_the_son_of_god.pdf">
<a href="/uploads/2/1/0/0/21005170/3d-pic-13_jesus_will_return.pdf">


选择全部PHP注释:

(?:#|//)[^\r\n]*|/\*[\s\S]*?\*/

屌爆了!一下子就把所有注释给删除掉!!

原文链接:https://www.f2er.com/regex/360993.html

猜你在找的正则表达式相关文章