我想从URL
得到一个值。问题是,它可能有一些特殊字符,我想删除它。意思是,http://localhost/DoSomething/Index/123#
是我的URL
。我可以得到123#
,现在我想从中删除#
。如何从jQuery中的URL中删除特殊字符?
实施例:
URL = http://localhost/DoSomething/Index/123#
结果= 123#
预期结果= 123
var sPageUrl = "http://localhost/DoSomething/Index/123#";
var number = sPageUrl.substring(sPageUrl.lastIndexOf('/') + 1);
alert(number);
我以为C#也有正则表达式 – user5014677