This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / Simple regexp questionhow to I get "name" from "name.sina.cn" ? thanks
-waiting(OK);
2008-1-28
{52}
(#4221314@0)
-
for something simple like that, just use indexOf and substring
-sowen(sowen);
2008-1-28
(#4221318@0)
-
/name.*/ BTW, as sowen said, you don;t have to use RegEx here.
-canadiantire(轮胎 - Do It Now);
2008-1-28
(#4221375@0)
-
sorry for misleading. Actually what I wanted is the string before the first dot.
-waiting(OK);
2008-1-28
(#4221408@0)
-
you can still use what sowen said without using regex
-mikesmith(老猫);
2008-1-28
(#4221443@0)
-
/^[^\.]*/
-canadiantire(轮胎 - Do It Now);
2008-1-28
(#4221514@0)
-
Up. And /[^.]*/ may work as well.
-sammy(_);
2008-1-30
(#4226007@0)
-
([^.]*)\.
-niu1986(只吃草的牛);
2008-1-28
(#4221435@0)
-
if (str.EndsWith(".sina.cn")) outPut = str.Replace(".sina.cn", "");
-deep_blue(BLUE);
2008-1-28
(#4221503@0)
-
Easy in perlif($string =~/^(\w+)\.\w+\.\w+/i){
$SS = $1;
}
-dancingcat(KaKa);
2008-1-28
{57}
(#4221585@0)
-
sed -e 's/\.*$//'
-647i(流浪的步行万里);
2008-1-28
(#4221689@0)
-
cut -d\. -f1
-647i(流浪的步行万里);
2008-1-28
(#4221700@0)