Разбор строки - PullRequest
       2

Разбор строки

2 голосов
/ 01 июля 2011

В моем коде Android есть строка, которую я хочу проанализировать.У меня есть следующий вид строки:

asdfsdfsdfsdfTESTwerasdfasdfsdf.jpgaasdfsdfasdf.jpgasf.jpg

Я хочу получить ссылку на файл jpg.

Он всегда начинается с "test" и заканчивается "jpg",но остальная часть строки динамически меняется, и за первой находятся другие ссылки.

Я использую этот шаблон: Pattern pattern = Pattern.compile("test[^j]*jpg");

Это работает.Но если есть "j" до jpg, я получаю неправильный вывод.Я не могу заменить [^j] только на *.Тогда у меня возникают другие проблемы.

Может ли кто-нибудь дать мне подсказку, чтобы я следовал test[^jpg]*jpg (так не работает).Так что проверять jpg не нужно j

Строка может выглядеть следующим образом (теперь длинная версия):

</script>  </div>  <div id="cttpd"></div> <div id="rcnt"> <div class="lhshdr"> <div class="lshdr" id="leftnavc"><div id=leftnav role=navigation style="position:absolute;top:1px;width:175px" onclick="google.srp&&google.srp.qs(event)"><div id=ms><ul><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=1&amp;ved=0CCkQ_AUoAA" class="kl"><span class=micon style="background-position:0 -132px"></span>Alles</a><li class="mitem msel"><span class=micon style="background-position:-60px -132px"></span>Bilder<li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=vid&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=3&amp;ved=0CCsQ_AUoAg" class="kl"><span class=micon style="background-position:-80px -132px"></span>Videos</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=nws&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=4&amp;ved=0CCwQ_AUoAw" class="kl"><span class=micon style="background-position:-120px -132px"></span>News</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=shop&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=5&amp;ved=0CC0Q_AUoBA" class="kl"><span class=micon style="background-position:-120px -152px"></span>Shopping</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=blg&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=6&amp;ved=0CC4Q_AUoBQ" class="kl"><span class=micon style="background-position:0 -152px"></span>Blogs</a></ul><ul class=nojsb  id="hidden_modes"><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=bks&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=7&amp;ved=0CC8Q_AUoBg" class="kl"><span class=micon style="background-position:-40px -152px"></span>Bücher</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=plcs&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=8&amp;ved=0CDAQ_AUoBw" class="kl"><span class=micon style="background-position:-80px -152px"></span>Places</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=mbl&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=9&amp;ved=0CDEQ_AUoCA" class="kl"><span class=micon style="background-position:-40px -172px"></span>Echtzeit</a><li class="mitem"><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=dsc&amp;source=lnms&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;sa=X&amp;oi=mode_link&amp;ct=mode&amp;cd=10&amp;ved=0CDIQ_AUoCQ" class="kl"><span class=micon style="background-position:0 -172px"></span>Diskussionen</a></ul><a href="#" id=showmodes class="jsb nj kl" onclick="google.x(this.id,function(){google.srp.toggleModes()});google.log('', '\x26ved\x3d0CCgQ_gU' +'&ei=' + google.kEI);return false" style="padding-left:16px"><span class="micon"></span><span class="msm">Mehr</span><span class="msl">Weniger</span></a></div><div class=lnsep></div><div style="clear:both;overflow:hidden"><h2 class=hd>Suchoptionen</h2><ul id=tbd class="med tbfo" data-loaded=1><li><ul class="tbt"><li class="tbos" id=isg_ onclick="return google.Toolbelt.tbosClk(event)">Nach Relevanz sortiert<li class="tbou" id=isg_to><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=isg:to&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CAcQpwUoAQ">Nach Thema sortiert</a></ul><li><ul class="tbt"><li class="tbos" id=isz_ onclick="return google.Toolbelt.tbosClk(event)">Alle Größen<li class="tbou" id=isz_l><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=isz:l&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CAoQpwUoAQ">Groß</a><li class="tbou" id=isz_m><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=isz:m&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CAsQpwUoAg">Mittel</a><li class="tbou" id=isz_i><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=isz:i&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CAwQpwUoAw">Piktogramm</a></ul><li><ul class="tbt"><li class="tbos" id=ic_ onclick="return google.Toolbelt.tbosClk(event)">Alle Farben<li class="tbou" id=ic_color><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:color&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CA8QpwUoAQ">Farbig</a><li class="tbou" id=ic_gray><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:gray&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBAQpwUoAg">Schwarz-Weiß</a><li class="tbou" id=ic_specific><a href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:red&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBEQpwU" class=q>Bestimmte Farbe</a><div id=sc-block style="margin-left:-2px;width:120px;height:40px;position:relative;left:-8px"><div id=swatch0 class="sc"><a id=sl0 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:red&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBIQpwU" style="background:#c00;display:block" title="Rot"></a></div><div id=swatch1 class="sc"><a id=sl1 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:orange&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBMQpwU" style="background:#fb940b;display:block" title="Orange"></a></div><div id=swatch2 class="sc"><a id=sl2 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:yellow&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBQQpwU" style="background:#ff0;display:block" title="Gelb"></a></div><div id=swatch3 class="sc"><a id=sl3 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:green&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBUQpwU" style="background:#0c0;display:block" title="Grün"></a></div><div id=swatch4 class="sc"><a id=sl4 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:teal&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBYQpwU" style="background:#03c0c6;display:block" title="Blaugrün"></a></div><div id=swatch5 class="sc"><a id=sl5 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:blue&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBcQpwU" style="background:#00f;display:block" title="Blau"></a></div><div id=swatch6 class="sc"><a id=sl6 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:purple&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBgQpwU" style="background:#762ca7;display:block" title="Violett"></a></div><div id=swatch7 class="sc"><a id=sl7 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:pink&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBkQpwU" style="background:#ff98bf;display:block" title="Rosa"></a></div><div id=swatch8 class="sc"><a id=sl8 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:white&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBoQpwU" style="background:#fff;display:block" title="Weiß"></a></div><div id=swatch9 class="sc"><a id=sl9 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:gray&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBsQpwU" style="background:#999;display:block" title="Grau"></a></div><div id=swatch10 class="sc"><a id=sl10 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:black&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CBwQpwU" style="background:#000;display:block" title="Schwarz"></a></div><div id=swatch11 class="sc"><a id=sl11 href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=ic:specific,isc:brown&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CB0QpwU" style="background:#885418;display:block" title="Braun"></a></div></div></ul><li><ul class="tbt"><li class="tbos" id=itp_ onclick="return google.Toolbelt.tbosClk(event)">Alle Typen<li class="tbou" id=itp_face><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=itp:face&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CCAQpwUoAQ">Gesicht</a><li class="tbou" id=itp_photo><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=itp:photo&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CCEQpwUoAg">Foto</a><li class="tbou" id=itp_clipart><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=itp:clipart&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CCIQpwUoAw">Clipart</a><li class="tbou" id=itp_lineart><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=itp:lineart&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CCMQpwUoBA">Strichzeichnung</a></ul><li><ul class="tbt"><li class="tbos" id=imgo_ onclick="return google.Toolbelt.tbosClk(event)">Standardansicht<li class="tbou" id=imgo_1><a class="q qs" href="/search?q=anja&amp;um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;source=lnt&amp;tbs=imgo:1&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CCYQpwUoAQ">Größen anzeigen</a></ul></ul></div></div></div> </div> <div id="center_col">  <span style="margin-right:0" id="taw">   <div></div>    </span> <div class="med" id="res" role="main"> <div id="rgsh_s"></div> <div id="topstuff">   <div class=tqref style="height:36px;overflow:hidden"><div style="width:9999px"><p class="rs std" style="padding-top:6px"><span>Verwandte Suchanfragen:</span> <a href="/search?um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;q=anja+mittag&amp;revid=1989647380&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CDQQ1QIoAA" style="padding-right:10px">anja <b>mittag</b></a><a href="/search?um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;q=anja+nejarri&amp;revid=1989647380&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CDUQ1QIoAQ" style="padding-right:10px">anja <b>nejarri</b></a><a href="/search?um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;q=anja+kling&amp;revid=1989647380&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CDYQ1QIoAg" style="padding-right:10px">anja <b>kling</b></a><a href="/search?um=1&amp;hl=de&amp;biw=1429&amp;bih=651&amp;tbm=isch&amp;q=anja+hollands&amp;revid=1989647380&amp;sa=X&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;ved=0CDcQ1QIoAw" style="padding-right:10px">anja <b>hollands</b></a></div></div>     </div> <div id="search">  <!--a--> <h2 class="hd">Suchergebnisse</h2> <div id="ires"> <ol id="rso">  <li><div id=rg><div id=rg_s><div id=rg_hp><a id=rg_hpl></a></div><div class=rg_h id=rg_h><div class=rg_hc><div class=f id=rg_hq style="font-size:10px;float:right;padding:0"></div><div class=std id=rg_hy style="font-size:10px;padding:0"><br/></div><a class=rg_hl id=rg_hl><img class=rg_hi id=rg_hi></a><div class=std id=rg_hx><p class=rg_ht id=rg_ht><a id=rg_hta></a></p><p class=rg_aht><span id=rg_aht><a id=rg_ahta></a></span></p><p class=rg_hn id=rg_hn></p><p class=rg_ahn id=rg_ahn1></p><p class=rg_ahn id=rg_ahn2></p><p class=rg_hr><span id=rg_hr></span></p><div class=rg_hs id=rg_hs></div><p class=rg_ahr><span id=rg_ahr></span></p><p class=rg_ahm><span id=rg_ahm></span></p><p class=rg_ha><span id=rg_ha><a class=rg_hal id=rg_hals></a><span id=rg_has>&nbsp;&#8209;&nbsp;</span><a class=rg_hal id=rg_haln></a><span id=rg_has2>&nbsp;&#8209;&nbsp;</span><a class=rg_hal id=rg_halm></a></span></p></div></div></div><span class=rg_ctlv><ul class=rg_ul data-pg=1 data-cnt=23><li class=rg_li data-row=1 style="width:118px;height:176px"><a href="/test?imgurl=http://i2.pinger.pl/pgr279/e554945d001ff23e4a33ea29/Anja-Rubik.jpg&amp;imgrefurl=http://blogis.npx.de/show_page/anja&amp;usg=__KKqVBsUH4vuCRZClbiKpDqH6vbQ=&amp;h=491&amp;w=298&amp;sz=21&amp;hl=de&amp;start=1&amp;sig2=5rjphg9mOt752AQGz7sbYg&amp;zoom=1&amp;tbnid=T_RkYuTt8Nc-rM:&amp;tbnh=130&amp;tbnw=79&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=T_RkYuTt8Nc-rM: src="http://t0.gstatic.com/images?q=tbn:ANd9GcQsxip7ry0l3aajkKyOsdB605f-X58O15BDmDTheAfU07BYuHA" data-sz=f height=194 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:168px;padding:4px 0 4px 0"><a href="/test?imgurl=http://www.anjastrauss.com/photos/anjaBlue.jpg&amp;imgrefurl=http://www.anjastrauss.com/bio.de.html&amp;usg=__xRevv41sxB_1k6_s-q761TYhMhA=&amp;h=1462&amp;w=1024&amp;sz=258&amp;hl=de&amp;start=2&amp;sig2=4X9f3M1_3l-zXjHle-6_2Q&amp;zoom=1&amp;tbnid=UUh0nEAu9yWT3M:&amp;tbnh=150&amp;tbnw=105&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=UUh0nEAu9yWT3M: src="http://t0.gstatic.com/images?q=tbn:ANd9GcRv6DHaomegatg0L8brZywWiCCuSpzavnhI7YIkmYGbiwC_nE08" data-sz=f height=168 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:152px;padding:12px 0 12px 0"><a href="/test?imgurl=http://www.charite.de/GRK1123/Bilder/anja-harmeier2.jpg&amp;imgrefurl=http://www.charite.de/GRK1123/students.htm&amp;usg=__F86rMvFn5H6BTOsIjqog-3VLGoM=&amp;h=433&amp;w=336&amp;sz=96&amp;hl=de&amp;start=3&amp;sig2=zySfMpJEVM4m-8hA-gvShw&amp;zoom=1&amp;tbnid=GKJJAWHfueGInM:&amp;tbnh=126&amp;tbnw=98&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=GKJJAWHfueGInM: src="http://t1.gstatic.com/images?q=tbn:ANd9GcT6rJ9xTvHmzIjyDDGV2tEBVOXc0C7MfKz3mNyZzl0Ki3N-NoQzo-iVbvNz" height=152 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:157px;padding:9px 0 10px 0"><a href="/test?imgurl=http://www.asta.mh-hannover.de/wp-content/uploads/2009/03/anja.jpg&amp;imgrefurl=http://www.asta.mh-hannover.de/gremien/stupa-praesidium/anja-vogelgesang/&amp;usg=__Smk7GtNJ2G3FUROfapVem0pFJqM=&amp;h=2048&amp;w=1536&amp;sz=1525&amp;hl=de&amp;start=4&amp;sig2=CC2i-NkRfZD8hiO_O1Hh-g&amp;zoom=1&amp;tbnid=jACxYDmQzLnJSM:&amp;tbnh=150&amp;tbnw=113&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=jACxYDmQzLnJSM: src="http://t1.gstatic.com/images?q=tbn:ANd9GcSQev5iYbxBCTlLh6041cifB5an9X0yzUVpxuVdkfZIeBKyO1Q3whWSXrzL" height=157 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:160px;padding:8px 0 8px 0"><a href="/test?imgurl=http://www.sfb580.uni-jena.de/typo3/uploads/tx_staff/anja.jpg&amp;imgrefurl=http://www.sfb580.uni-jena.de/typo3/258.0.html%3F%26no_cache%3D1%26tx_staff_pi1%255Bkey%255D%3Dvs80-bpC6&amp;usg=__IvcD-NdQxXRDTpiBjR1n3OWkHrs=&amp;h=632&amp;w=467&amp;sz=48&amp;hl=de&amp;start=5&amp;sig2=Gvs9KSpv0rwkiHUJ3paJsA&amp;zoom=1&amp;tbnid=6_hcBL7Pu9Cz4M:&amp;tbnh=137&amp;tbnw=101&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=6_hcBL7Pu9Cz4M: src="http://t0.gstatic.com/images?q=tbn:ANd9GcRleOOKOMbq8J5UgnLeo2KusrDGS5u8Zab_qmM_0ybPOhdRtdRafoUS7Gw" height=160 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:176px"><a href="/test?imgurl=http://www.jugend-kulturell.de/wp-content/uploads/anja_launhardt_portraitfoto_10x15cm_300dpi.jpg&amp;imgrefurl=http://www.jugend-kulturell.de/2009/04/21/die-jury-2009-anja-launhardt/&amp;usg=__nKGMyN-p-d6hM0VOeg3ry2XmvO4=&amp;h=1772&amp;w=1181&amp;sz=1527&amp;hl=de&amp;start=6&amp;sig2=pGQ08xzLYwoLj1PdKTHktw&amp;zoom=1&amp;tbnid=33GYiqZzYPKAeM:&amp;tbnh=150&amp;tbnw=100&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=33GYiqZzYPKAeM: src="http://t0.gstatic.com/images?q=tbn:ANd9GcT3Yw52Ul6C1vhW2VKSucsmeamwgsLXCNRRvf0VYvnCFO4f_piR4A" data-sz=f height=177 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:176px"><a href="/test?imgurl=http://www.anja-rupprecht.de/fotos/anja-rupprecht_01.jpg&amp;imgrefurl=http://www.anja-rupprecht.de/kontakt.html&amp;usg=__Se63VK3WhFMLzt9dpAYGwRmtyQ4=&amp;h=3456&amp;w=2304&amp;sz=2862&amp;hl=de&amp;start=7&amp;sig2=tQvd5l8YEV8FUaqMXfASQQ&amp;zoom=1&amp;tbnid=k4o5J0nYbyqNXM:&amp;tbnh=150&amp;tbnw=100&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=k4o5J0nYbyqNXM: src="http://t1.gstatic.com/images?q=tbn:ANd9GcTPoqJXXy94PR1S989VBCHnb2xw4Z6GkaB2Ayg_qQMM0u6bGt3J" data-sz=f height=177 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:118px;height:157px;padding:9px 0 10px 0"><a href="/test?imgurl=http://www.spd-berlin.de/w/files/bilder_dowload_ah-fraktion/hertel_anja0043.jpg&amp;imgrefurl=http://www.spd-berlin.de/landesverband/personen-a-z/personen-g-l/hertel-anja/&amp;usg=__1Od8mAIN5ZRiwN08JwQZLpFByuY=&amp;h=2400&amp;w=1800&amp;sz=1312&amp;hl=de&amp;start=8&amp;sig2=-Pk9Nm4VaWdRz3LE5AIa-g&amp;zoom=1&amp;tbnid=mYL30GqMUZVUSM:&amp;tbnh=150&amp;tbnw=113&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=mYL30GqMUZVUSM: src="http://t3.gstatic.com/images?q=tbn:ANd9GcQQV0Kt4ZAZxxzaaas3H_vjOFRvFFZZthPE6c8MMyFpFWBv0QkmUHcGn4U" height=157 width=118  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:120px;height:148px;padding:14px 0 14px 0"><a href="/test?imgurl=http://www2.wiwi.hu-berlin.de/institute/vers/german/pers/gfx/Anja.jpg&amp;imgrefurl=http://www.wiwi.hu-berlin.de/vers/german/pers/personal.html&amp;usg=__Pzw_8PzJCYzGUwQkTQxPcZWWNIA=&amp;h=1843&amp;w=1499&amp;sz=32&amp;hl=de&amp;start=9&amp;sig2=N7Rrg3xJlXvuMrOjJwFJEg&amp;zoom=1&amp;tbnid=bWOEhAMJ7rQFWM:&amp;tbnh=150&amp;tbnw=122&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=bWOEhAMJ7rQFWM: src="http://t0.gstatic.com/images?q=tbn:ANd9GcSsaBZjowa1D7s58hpBlFtYM6_w15MYuO8tMkzuAcVPINAfpMcr00axNjBn" height=148 width=120  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li data-row=1 style="width:134px;height:134px;padding:7px 0 8px 0"><a href="/test?imgurl=http://www.etc-jugend.de/main/mitglieder/Anja/Anja.jpg&amp;imgrefurl=http://www.etc-jugend.de/main/mitglieder/Anja/Anja.html&amp;usg=__QSU61qh3DL5CdWkbqMiYmwxjg54=&amp;h=768&amp;w=768&amp;sz=55&amp;hl=de&amp;start=10&amp;sig2=MmK0dPDl5r3VR3d8NFQpxQ&amp;zoom=1&amp;tbnid=xCnC2LrmAXC8ZM:&amp;tbnh=142&amp;tbnw=142&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=xCnC2LrmAXC8ZM: src="http://t2.gstatic.com/images?q=tbn:ANd9GcSo7qqLBrzOjexODqkkgwtmjDm5ZXcJtCa9aROFSNNtaN3KgqA0D0vNKxo-" height=134 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:145px;padding:2px 0 2px 0"><a href="/test?imgurl=http://www.anja-schueller.de/images/anja1.jpg&amp;imgrefurl=http://www.anja-schueller.de/anja.htm&amp;usg=__EIe7rolzBqnWN95vWrLzjU3TNOI=&amp;h=1143&amp;w=1055&amp;sz=146&amp;hl=de&amp;start=11&amp;sig2=-STV1TEn6J2NcaxKCQmegQ&amp;zoom=1&amp;tbnid=-mLxHfuUbO2dBM:&amp;tbnh=150&amp;tbnw=138&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=-mLxHfuUbO2dBM: src="http://t1.gstatic.com/images?q=tbn:ANd9GcToLqwa0VTTW5AAU5T2DnPv3-f6irqcgzuRKrqpenJPA23tArafO5D19MpZ" height=145 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:149px"><a href="/test?imgurl=http://www.proteomics-online.de/Anja.jpg&amp;imgrefurl=http://www.proteomics-online.de/Anja.html&amp;usg=__zq-gvb3iy8oruHV5mHmRtMeCnU8=&amp;h=2068&amp;w=1852&amp;sz=208&amp;hl=de&amp;start=12&amp;sig2=7RVGX9cIcNJcXw-eQJ0y8A&amp;zoom=1&amp;tbnid=fykvzaEDO4DLZM:&amp;tbnh=150&amp;tbnw=134&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=fykvzaEDO4DLZM: src="http://t3.gstatic.com/images?q=tbn:ANd9GcQao-EEOmXDdw9CI18fnjrLhryhC3Bobc-5YL1igwGiXgC-Bca4" data-sz=f height=150 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:121px;padding:14px 0 14px 0"><a href="/test?imgurl=http://www.artundflair.de/Anja_Lucas-Roth/Anja_2_heller_96ppi.jpg&amp;imgrefurl=http://www.artundflair.de/Anja_Lucas-Roth/anja_lucas-roth.html&amp;usg=__b7B9tp7E1sGSU45EAi2EFL5uPpw=&amp;h=906&amp;w=1002&amp;sz=83&amp;hl=de&amp;start=13&amp;sig2=L8pXvELcy329u21N-8RHlQ&amp;zoom=1&amp;tbnid=H9ic8TnpVzTs9M:&amp;tbnh=135&amp;tbnw=149&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=H9ic8TnpVzTs9M: src="http://t0.gstatic.com/images?q=tbn:ANd9GcQa0aMSlTkKhytOaS3BLzCs1tT7hREG6OXUB4dRZu1KxX6Po6864sYkKI8_wQ" height=121 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:149px"><a href="/test?imgurl=http://www.westga.edu/~anja/anja.jpg&amp;imgrefurl=http://blogis.npx.de/show_page/anja&amp;usg=__isLTFSr7BsZxRQuRJU13adYwddk=&amp;h=435&amp;w=390&amp;sz=42&amp;hl=de&amp;start=14&amp;sig2=n2IO0KhP63BKIUKdaMan_A&amp;zoom=1&amp;tbnid=RVnGq10w5L47fM:&amp;tbnh=126&amp;tbnw=113&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=RVnGq10w5L47fM: src="http://t2.gstatic.com/images?q=tbn:ANd9GcRMOzixsvjW-T1gb1j1axkgidOEFZ-CsRXJ2y0cgOPODElEFfr3YA" data-sz=f height=149 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:149px"><a href="/test?imgurl=http://www.flurfunk-dresden.de/wp-content/uploads/2008/10/anja_herrmann_re.jpg&amp;imgrefurl=http://www.flurfunk-dresden.de/2008/10/03/dresden-fernsehen-anja-herrmann-ubernimmt-studioleitung/&amp;usg=__7J3RHv1_71pa2zdIB535TN08Big=&amp;h=449&amp;w=400&amp;sz=188&amp;hl=de&amp;start=15&amp;sig2=nNJy8dywLXbUIbe9sNrIeg&amp;zoom=1&amp;tbnid=ea2pvvQ_uvOf3M:&amp;tbnh=127&amp;tbnw=113&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=ea2pvvQ_uvOf3M: src="http://t1.gstatic.com/images?q=tbn:ANd9GcTCQdrD987J885rmWYCHykSKwjWjWlBmg6p1fzg-ny07r_YFD83ZA" data-sz=f height=150 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:134px;height:131px;padding:9px 0 9px 0"><a href="/test?imgurl=http://www.kempf-fische.de/Anja%2520Kempf%2520fischt/anja-kempf-flussbarsch.jpg&amp;imgrefurl=http://www.kempf-fische.de/&amp;usg=__5b-NJjAk3_z5NNt_UmpTodNR_J8=&amp;h=489&amp;w=500&amp;sz=112&amp;hl=de&amp;start=16&amp;sig2=aSMqH117jTbpisQCgGvK6Q&amp;zoom=1&amp;tbnid=75qTfn1G0RXRtM:&amp;tbnh=127&amp;tbnw=130&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=75qTfn1G0RXRtM: src="http://t3.gstatic.com/images?q=tbn:ANd9GcRUBXkzpIq82r8R5U5IZU-eRGVfPI5FNaR0EsytNAdRZ419JvG3FnMNLyiA" height=131 width=134  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li style="width:138px;height:138px;padding:5px 0 6px 0"><a href="/test?imgurl=http://www.anjahackl.de/2007/bilder/coaching_news/anja1.jpg&amp;imgrefurl=http://www.anjahackl.de/cms/index.php%3Fpage%3Dcoaching_news&amp;usg=__N6WskbQhatcV_XU7gDIK03INMrA=&amp;h=500&amp;w=500&amp;sz=29&amp;hl=de&amp;start=17&amp;sig2=KLjqv2NAFA6CvZ8uvNvrYw&amp;zoom=1&amp;tbnid=UNyYPrg3Sbc4YM:&amp;tbnh=130&amp;tbnw=130&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=UNyYPrg3Sbc4YM: src="http://t0.gstatic.com/images?q=tbn:ANd9GcRohaFEMEcskZp3_-y9iuEgNHIUltUZ3zHoBZ5X1rNxY-Gcg1YPxvPHoG85LQ" height=138 width=138  onload="google.stb.csi.onTbn(1, this)"></a></li><li class=rg_li data-row=1 style="width:183px;height:120px"><a href="/test?imgurl=http://www.nordische-musik.de/artikel/fotos/anja01.jpg&amp;imgrefurl=http://www.nordische-musik.de/artikel/anja-garbarek.php&amp;usg=__6F6bC5VWbUWMsjdL2jOgbwdPTuY=&amp;h=395&amp;w=611&amp;sz=16&amp;hl=de&amp;start=18&amp;sig2=ZhtpRlIFb0Xqa9VSTAOwWg&amp;zoom=1&amp;tbnid=mjlvJBergUpi_M:&amp;tbnh=88&amp;tbnw=136&amp;ei=xOANTu_YCITBswbrqLmIDw&amp;prev=/search%3Fq%3Danja%26um%3D1%26hl%3Dde%26sa%3DN%26biw%3D1429%26bih%3D651%26tbm%3Disch&amp;um=1&amp;itbs=1" class=rg_l ><img class=rg_i name=mjlvJBergUpi_M: 

Я хочу получить это: test? Imgurl = http://i2.pinger.pl/pgr279/e554945d001ff23e4a33ea29/Anja-Rubik.jpg

Ответы [ 3 ]

2 голосов
/ 01 июля 2011
 "test(.*?\\.jpg)"

это регулярное выражение будет соответствовать имени файла

1 голос
/ 01 июля 2011

Возможно, вы захотите прекратить потребление символов на точке. В этом случае вы должны использовать escape-последовательность: \., например: (test\w+)\.jpg

Скобки используются для захвата нужной вам части. Не стесняйтесь перемещать их.

Вы можете проверить wikipedia для получения дополнительной информации о регулярных выражениях.

0 голосов
/ 01 июля 2011

Я думаю, что это можно сделать, используя неохотный квантификатор, а не реактив:

test. * (Jpg) {1}?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...