1
我根本无法弄清楚这一点,并试图一段时间。我需要一个正则表达式,将通过以下方式分析数据:解析这个或这个使用正则表达式
比方说我有下面的格式输入:
www.google.com
www.google.com/
www.google.com/something
我需要一个正则表达式,它将分析上述三个URL(独立)到最后的结果:
www.google.com
www.google.com
www.google.com
但是,它需要与他们的方式,是基于以下几点:
Parse and return everything to the left of a "/" if one exists in the line
Parse and return the entire line if no "/" exists in the line
我是新来的正则表达式,所以虽然这可能很简单,但我无法弄清楚。
当你说“a /的左边”时,你的意思是第一个还是最后一个“/”? – fge 2011-12-16 11:41:37