This question already has answers here:
IIS7 URL Rewriting Module Replace
(5 answers)
Closed 3 years ago.
I want
Input :www.example.com/videos/video1%2Cvideo2%2Cvideo3%2Cvideo4%2C Output:www.example.com/videos/video1,video2,video3,vide4
So i need regular expression. I tried this:^videos/[%2C](in iss url rewriting pattern). But not it is not work. It said the input data to test does not match the patter.
In your query, you mentioned it as "video", whereas in your regular expression, it is mentioned as "videos". This typo might be reason for the pattern mismatch error. Please cross check.
Related
This question already has answers here:
URLs: Dash vs. Underscore [closed]
(18 answers)
Closed 8 months ago.
I'm getting a little confused about choosing the more right URL i would appreciate if you could recommend which one is better
domain.com/admin/manage_vehicles
or
domain.com/admin/manage-vehicles
or
domain.com/admin/manage/vehicles
The 3rd way is the most user friendly way to make a URL.
It will be more useful when you have multiple routes of that same category.
domain.com/admin/manage/vehicles
domain.com/admin/manage/drivers
domain.com/admin/manage/passengers
But as an alternative, you can use the the 2nd way too.
domain.com/admin/manage-vehicles
domain.com/admin/manage-drivers
domain.com/admin/manage-passengers
Hyphens are recommended by Google over underscores (source).
Hyphens are more familiar to the end user.
And last of all, underscores and keyword joins are not recommended in URLs.
domain.com/admin/manage_vehicles
domain.com/admin/manageVehicles
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm tracing the post variables via params.inspect and see that I have a param called birthday(1i)
How can I grab that into a variable?
I've tried myvar = param["birthday(1i)] but that did not work
Is there a normal way to access param hash values by a key that contains special characters? I'm completely new to Ruby so this seems odd.
A parameter named like birthday(1i) indicates to me that you are using the Rails date_select helper method in the view. When you use the date_select helper and have an attribute birthday in your model then you should be able to allow that params to be set with a common
params.require(:model_name).permit(:birthday)
When you are really interested in the birthday(1i) part of the param then you can read it with
myvar = params[:birthday]['1i']
This question already has answers here:
Swagger: wildcard path parameters
(2 answers)
swagger: file path in path parameter
(1 answer)
Closed 2 years ago.
Some of my APIs use a file path as the path parameter (Ex. .../hello/test.txt) which will include a forward slash. However in Swagger, it always escapes the forward slash such that my intended URL of
https://editor.swagger.io/DStoreRESTExample/api/v1/hello/test.txt
becomes
https://editor.swagger.io/DStoreRESTExample/api/v1%2Fhello%2Ftest.txt which throws errors because it's not a valid URL.
Is there any way to work around this? From what I understand is that they don't plan on putting a fix to this even in future releases of Swagger.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Standard URL encode function?
I need to transofrm a Delphi string (like TEdit.Caption) in a "url capable" string.
I need this because I will open google maps programmatically like in TEdit I write "High Street, Sydney"
and then i would like to open the browser at maps.google.com/maps?q=High+Street+Sidney
Is there a ready function to do this, also to parse accents?
You can add IdURI unit from Indy to your uses clause, and use TIdURI.URLEncode() method to encode a URL, and TIdURI.Decode() to decode an encoded URL to a normal string.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Ruby code to extract host from URL string
I found this module called URI which can parse the url. (I'm pretty new to ruby. Is 'module' synonymous with 'library' in this case?) You can then extract the host name.
uri = URI.parse("http://www.ruby-lang.org/")
...
p uri.host
# => "www.ruby-lang.org"
From this, I suppose you could remove 'www.' and keep other subdomains using regular expressions.
Does anyone have a more straight-forward alternative or does this approach seem right?
So while posting my own answer, I'm not saying that gems like domainatrix or public_suffix_server aren't good elegant solutions (although the latter bugged on me immediately which caused me to go this route).
People suggesting using split() made me realize that I could just sub out 'www.' if it existed and otherwise leave domains as they are without installing gems and using 1 simple line of code:
url = request.original_url
domain = URI.parse(url).host.sub(/\Awww\./, '')
This works with subdomains and multi-part suffixes (eg. co.uk). Anybody see anything wrong with this?
EDIT: Thanks sorens for pointing out the weak regex I was originally using. This expression is certainly better.
You can use domainatrix gem to get what you want: url.domain + url.public_suffix, but you can just do some string manipulation like uri[4..-1].