dua6992
dua6992
2011-04-11 17:35

正则表达式获取URL兼容目录?

已采纳

I have an internal link system on my site, and I currently use this to detect text after a markup:

'/__IL__(.+)/'

The problem with this is that it picks up characters like "<", meaning if someone uses a line break, the result will be this:

http://www.[sitename].org/[user's url] <br/>

What would be a better regex expression for that? Thanks.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dream6120 dream6120 10年前

    Try instructing your regular expression to include all characters BUT the character that begins an HTML tag:

    '/__IL__([^<]+)/'

    点赞 评论 复制链接分享

为你推荐