[问题]问一个正则表达式(已解决)

软件和网站开发以及相关技术探讨
回复
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

[问题]问一个正则表达式(已解决)

#1

帖子 sanz » 2007-06-27 17:11

asdf<a href=asdf>asdf</a>asdf

要求提出所有的不在<>内的asdf字符串,也就是第1、3、4个asdf
上次由 sanz 在 2007-06-28 13:34,总共编辑 1 次。
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2007-06-27 18:56

是去掉<>吧。要不有什么意义。
● 鸣学
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

#3

帖子 sanz » 2007-06-27 19:02

不是去掉<>,是要保留的。
我要替换asdf文本,但是经常href里也有asdf,地址是要保留的,也被替换掉了。这就是问题所在
上次由 sanz 在 2007-06-27 19:04,总共编辑 1 次。
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#4

帖子 eexpress » 2007-06-27 19:04

用<和>先断行,不就容易替换了???
● 鸣学
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#5

帖子 BigSnake.NET » 2007-06-27 19:06

\>asdf\<

...
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#6

帖子 eexpress » 2007-06-27 19:06

强力下载网页图,有个脚本。你搜索。作参考。
● 鸣学
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

#7

帖子 sanz » 2007-06-27 19:07

是个思路,sed里我经常这样做。php里我倒没有试过,有没有更好的建议啊?
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

#8

帖子 sanz » 2007-06-27 19:08

BigSnake.NET 写了:\>asdf\<

...
没有看清问题吧?
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#9

帖子 BigSnake.NET » 2007-06-27 19:09

[^=]asdf 需要替换的后向引用支持

sed 支持否?或者有没有位置指定功能?据我所知没有

还是用perl吧
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

#10

帖子 sanz » 2007-06-27 21:41

sed 里我是用EXPRESS说的笨办法处理过的。现在是在PHP里,似乎没有后向引用。

perl里的表达式是怎么写的?
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
sanz
帖子: 1010
注册时间: 2006-09-29 5:11

#11

帖子 sanz » 2007-06-28 13:33

封贴。就先将就着用吧。
Dell D620 -> Asus U44SG
Dapper->Edgy->Feisty->Gutsy->Hardy->Karmic->Lucid -> Oneric -> Precise->Trusty
Python+JS
kamael
帖子: 7
注册时间: 2007-06-10 23:00

#12

帖子 kamael » 2007-07-03 20:36

i am working on regular expression operations these days as well...
回复