求一正则表达式

求一正则表达式

求一个正则表达式从如下的文本字符中抓取一段字符

下面的是 字符
Search:. Login 路 Settings 路 Help/Guide 路 About Trac 路 Wiki 路 Timeline

路 Roadmap 路 Browse Source 路 View Tickets 路 Search 路 Last Change 路

Revision Log ...

trac.mu.wordpress.org/browser/trunk/wp-signup.php - 119k - Cached - Similar

pages



<?php define( "WP_INSTALLING", true ); require( &#39;wp-config.php

...



<?php define( "WP_INSTALLING", true ); require(

&#39;wp-config.php&#39; ); add_action( &#39;wp_head&#39;,

&#39;signuppageheaders&#39; ) ; require( &#39;wp-blog-header.php&#39; ) ...

trac.mu.wordpress.org/browser/ trunk/wp-signup.php?format=txt - 18k - Cached -

Similar pages

More results from trac.mu.wordpress.org »



Weblogs at Harvard Law School



Get your own Weblogs at Harvard Law School account in seconds. Fill out this

two-step form and you&#39;ll be blogging seconds later! ...

blogs.law.harvard.edu/wp-signup.php - 5k - Cached - Similar pages



MyTypes: Blogging Community by MyTypes.com - social networking for ...



The best small business Blogging software with create a blog that has built in

marketing for your blog. MyTypes.com offers free blog hosting, ...

mytypes.com/wp-signup.php - 31k - Cached - Similar pages



WordPress Error



WordPress. Sorry, only Slovenian residents can sign up for a blog at BLOGOS. You

appear to be coming from the following country code: US ...

blog.siol.net/wp-signup.php - 2k - Cached - Similar pages



Lawyers and their lockers - wp-signup.php news and wp-signup.php ...



ARTICLES. Do take advice from your bankruptcy lawyer A bankruptcy lawyer is

there to represent and protect his client during the bankruptcy process, ...

lawyerslocker.com/wp-signup.php - 10k - Cached - Similar pages



Get your own account in seconds



WordPress database error: [Can&#39;t find file:

&#39;./wb_mu/wp_sitemeta.frm&#39; (errno: 13)] SELECT meta_value FROM

wp_sitemeta WHERE meta_key = &#39;illegal_names&#39; AND ...

wakeboardrider.com/wp-signup.php - 4k - Cached - Similar pages



Get your own account in seconds



WordPress database error: [Table &#39;db195959069.wp_sitemeta&#39; doesn&#39;t

exist] SELECT meta_value FROM wp_sitemeta WHERE meta_key =

&#39;illegal_names&#39; AND site_id ...

khronosjapan.com/wp-signup.php - 4k - Cached - Similar pages



Blogging at SUNY Cortland



Get your own Blog.cortland.edu account in seconds. Fill out this one-step form

and you&#39;ll be blogging seconds later! ...

blog.cortland.edu/wp-signup.php?new=2008 - 4k - Cached - Similar pages


抓取的就是 红色标识的那些 字符串

本人对正则不熟 所以求高人指点一下 谢谢了

好像就是"..."与"php"  这之间的字符串就好了
Sorry, 用 perl 写的

[Copy to clipboard] [ - ]
CODE:
print "$1\n" if /(\S+wp-signup\.php )/;

>perl -w test.pl
trac.mu.wordpress.org/browser/trunk/wp-signup.php
blogs.law.harvard.edu/wp-signup.php
mytypes.com/wp-signup.php
blog.siol.net/wp-signup.php
lawyerslocker.com/wp-signup.php
wakeboardrider.com/wp-signup.php
khronosjapan.com/wp-signup.php
>Exit code: 0

偶汗   欺负我不会PERL


QUOTE:
原帖由 guijia8427 于 2008-5-10 09:12 发表
偶汗   欺负我不会PERL

其实python的你照着改改也出来了
那位老大帮我改下cobrawgl    写的正则啊
我今天看了一天正则 头都晕了 还是没懂


cobrawgl  谢谢啊!
不用改,直接用就可以了

_dict=re.findall('(\S+wp-signup\.php )',_string)
import re
string = 'trac.mu.wordpress.org/browser/trunk/wp-signup.php - 119k - Cached - Similar'
regex = re.compile(r'(\S+wp-signup\.php )')
match = regex.match(string)

if match:
        print match.group(1)

____________

看了看 python


QUOTE:
原帖由 3227049 于 2008-5-10 20:39 发表
不用改,直接用就可以了

_dict=re.findall('(\S+wp-signup\.php )',_string)

谢谢


QUOTE:
原帖由 cobrawgl 于 2008-5-10 20:42 发表
import re
string = 'trac.mu.wordpress.org/browser/trunk/wp-signup.php - 119k - Cached - Similar'
regex = re.compile(r'(\S+wp-signup\.php )')
match = regex.match(string)

if match:
        print ma ...

谢谢啊
我对正则真是不感冒
但是如果我想
blog.cortland.edu/wp-signup.php?new=2008 - 4k - Cached - Similar pages
提出blog.cortland.edu/wp-signup.php?new=2008 这个又怎么办呢