slash

removing multiple groups of slashes everywhere in URL in .htaccess

若如初见. 提交于 2019-12-08 10:09:00
问题 I currently have a website where guests are able to access each url with any number of slashes to separate folder names. For example, if a URL is supposed to be: http://example.com/one/two/three/four Then users could access the same page via any of the following: http://example.com/one//two///three////four///// http://example.com/one/two////three/four///// http://example.com///one///////////two////three/four/ http://example.com///////////one///////////two/three/four However, I want the above

How do you grep for a string containing a slash?

跟風遠走 提交于 2019-12-05 11:47:51
问题 How should I grep for a string containing a forward slash like ./. ? 回答1: You'll just need to escape the periods with a backslash. So if I have a file foo.txt with contents: ./. foo bar ./. I can run grep \./\. test.txt , which should just print the two ./. lines. 回答2: The forward slash is not a special character in grep, but may be in tools like sed, Ruby, or Perl. You probably want to escape your literal periods, though, and it does no harm to escape the slash. This should work in all cases

Escaping backslash in Postgresql

☆樱花仙子☆ 提交于 2019-12-05 08:07:48
I'm trying to write an sql function in Postgresql that will parse a file path. I want to return just the file name. I cannot get past getting an accurate text string in the function. Here is the function: Function: job_page("inputText" text) DECLARE $5 text; BEGIN $5 = quote_literal("inputText"); return $5; END When I run this: select job_page('\\CAD_SVR\CADJOBS\7512-CEDARHURST ELEMENTARY SCHOOL\7512-20.DWG') I get this result: "E'\\CAD_SVRCADJOBSé2-CEDARHURST ELEMENTARY SCHOOLé2-20.DWG'" Postgresql interprets the slash followed by certain characters as a special character. How do I escape?

Remove a trailing slash from a string(changed from url type) in JAVA

拥有回忆 提交于 2019-12-04 23:37:38
I want to remove the trailing slash from a string in Java. I want to check if the string ends with a url, and if it does, i want to remove it. Here is what I have: String s = "http://almaden.ibm.com/"; s= s.replaceAll("/",""); and this: String s = "http://almaden.ibm.com/"; length = s.length(); --length; Char buff = s.charAt((length); if(buff == '/') { LOGGER.info("ends with trailing slash"); /*how to remove?*/ } else LOGGER.info("Doesnt end with trailing slash"); But neither work. There are two options: using pattern matching (slightly slower): s = s.replaceAll("/$", ""); or: s = s.replaceAll

How do you grep for a string containing a slash?

房东的猫 提交于 2019-12-04 01:00:58
How should I grep for a string containing a forward slash like ./. ? You'll just need to escape the periods with a backslash. So if I have a file foo.txt with contents: ./. foo bar ./. I can run grep \./\. test.txt , which should just print the two ./. lines. The forward slash is not a special character in grep, but may be in tools like sed, Ruby, or Perl. You probably want to escape your literal periods, though, and it does no harm to escape the slash. This should work in all cases: \.\/\. 来源: https://stackoverflow.com/questions/11234858/how-do-you-grep-for-a-string-containing-a-slash

Why does the cmd.exe shell on Windows fail with paths using a forward-slash ('/'') path separator?

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used: C:\temp\tcbugs>mkdir "dir1 with spaces" C:\temp\tcbugs>echo hi > "dir1 with spaces"\foo.txt C:\temp\tcbugs>type "dir1 with spaces\foo.txt" hi C:\temp\tcbugs>type "dir1 with spaces/foo.txt" The system cannot find the file specified. What is particularly interesting about this is that it appears to be specific to the cmd.exe shell and doesn't occur in PowerShell (nor

.htaccess remove trailing slash after file extension

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some external links to my site that referrer to pages with a file extension and a trailing slash after that e.g. http://example.com/folder/page.php/ I can not change these links, but I would like to 301 redirect those links to this format instead: http://example.com/folder/page/ I've tried this, but it doesn't work: RewriteRule ^(.*)\.php\/$ /$1/ [R=301,L] Any help is appreciated. 回答1: Try this in your /.htaccess file RewriteEngine On RewriteCond %{THE_REQUEST} /([^.]+)\.php/? [NC] RewriteRule ^ /%1/ [NC,R,L] RewriteCond %{REQUEST

Can't create/write to file (Errcode: 22)

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Quite new with SQL I'm looking to export some data from a MySQL database into a csv file. I'm working locally (localhost). Here is my SQL statement: SELECT DISTINCT * INTO OUTFILE 'C:\Users\Martin\Downloads\result.csv' FROM provider, location, provider_has_location WHERE provider.idprovider = provider_has_location.provider_idprovider AND location.idLocation = provider_has_location.location_idLocation LIMIT 20 MySQL return the following error: Can't create/write to file 'C:UsersMartinDownloads esult.csv' (Errcode: 22) Thanks for your help.

What's wrong with my url encoding?

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In my asp.net mvc application I created the following link: http : //localhost:2689/en/Formula.mvc/351702++LYS+GRONN+5G+9%252f2++fds I get error 400 (bad request). I think it blocks at the %25 (forward slash). What am I doing wrong? --EDIT 3-- I tried not encoding anything at all but rather rely on the default encoding of Url.RouteUrl(). It seems that this doesn't encode the "/" for some reason. If I encode it myself first, I end up with the doubel encoded %252f. This gives me a bad request for some reason.. Why?! --EDIT 2-- I

Azure, access denied on Shared Access Signature for Storage 2.0

匿名 (未验证) 提交于 2019-12-03 08:48:34
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having trouble getting shared access signatures to work with Storage 2.0.. I use the code: if (blob.Exists()) { var expires = DateTime.UtcNow.AddMinutes(30); var sas = blob.GetSharedAccessSignature(new Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPolicy { Permissions = Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Read, SharedAccessExpiryTime = expires }); url = string.Concat(blob.Uri.AbsoluteUri, sas); } return url; But if I debug the session and paste the URL into a browser, I get an error: <Error> <Code