Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Why is the webpage destroyed when I add a special character to the URL, especially the /?
For example,
myproject.loc/page1.php/
How can I solve this?
Try to encode your URL while you are creating it. If the URL is gonna be created by javascript encode it by following command:
encodeURIComponent('myproject.loc/page1.php/"?');
or if you are creating URL in PHP use this:
urlencode('myproject.loc/page1.php/"?');
However it's not recommanded to use some special characters in a website URLs which want to follow SEO
When you put a trailing slash after page1.php your browser interprets it as a directory and it ruins all of your relative paths.
If you really want the trailing slash after a filename you would need to use apache url rewrites.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 months ago.
Improve this question
Having a hard time with Regex.
What would be the regex for finding a file name with variable in between them?
For eg:
File name : DON_2010_JOE_1222022.txt
In the above file name the words DON, JOE and the format .txt will remain constant. Rest numbers might change for every file. There could be characters as well instead of numbers in those two places.
What im looking for is basically something like DON_*_JOE_*.txt with * being whatever it could be.
Can someone please help me with this?
I tried DON_*_JOE_*.txt and obviously it did not work.
DON_(?<firstString>.*)_JOE_(?<secondString>.*).txt
You can use this. To access the specific group, you can use matcher.group("firstString").
In JavaScript:
"DON_2010_JOE_1222022.txt".match(/DON_.+_JOE_.+\.txt/)
whatever it could be
It is .+ except new lines.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to create a system where the user will input their Wikipedia page link, and the application will get the page title from Wikipedia page URL.
Like, if the user gives: https://id.wikipedia.org/wiki/Eminem, I want to get the page title Eminem.
Or if the user gives: https://id.wikipedia.org/wiki/Eminem#1992%E2%80%931997:_Awal_karier,_Infinite_dan_masalah_keluarga, I want the page title, which is Eminem
I've tried finding a regex pattern. I'm thinking about what if I could create/ find a regex pattern that would find words that sit between /wiki/ and ends with a /. So far didn't found any way to do that.
So what can I do? What other options I have?
this would partly work: /(?<=https?:\/\/..\.wikipedia\.org\/wiki\/).+(?=\/(.+)?|#)/
It doesn't work without a / at the end though.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm currently creating directories with a variable called currentDate.
I am trying to create the following directory:
business/bookings/15/06/2020 //3 levels down. the date is a level.
with business/bookings/currentDate
However, JavaScript and Firebase will interpret the '/' as another directory.
How could I solve this problem given that I'll get a variable that's always formatted this way?
A very simple substitution would be with escape/unescape, but nowadays I'd probably use encodeURIComponent/decodeURIComponent:
encodeURIComponent("business/bookings/currentDate")
"business%2Fbookings%2FcurrentDate"
decodeURIComponent("business%2Fbookings%2FcurrentDate")
"business/bookings/currentDate"
Short version: you can't.
The / character is not admitted in file (and directories) name. What you can do is to substitute the slash character with something else.
Hope this helps.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on a signature creator where you have some input fields and it generates an html page which you can use in Outlook as a signature. The problem is when there are special characters in 1 of the input fields, it will display some random characters ( e.g. é becomes é ). I've got some code to encode the special characters to html safe characters, but these get automatically converted back when injected in the html page. Is there a way to get the encoded characters into the html?
Here's jsfiddle of my problem (Open console in browser to view results):
https://jsfiddle.net/hdywwwf4/
This is what I want:
<h2 id="tester">ééé</h2>
This is what I get:
<h2 id="tester">ééé</h2>
Try using .innerText() to set the h2 content instead of .innerHTML()
This results in following element:
<h2 id="tester">ééé </h2>
https://jsfiddle.net/hdywwwf4/3/
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
how do I find whether default JavaScript file working or not?? Can same one give me small code example for this ??
If you are using Ruby on Rails version 2, a quick way to find this out is to browse the source of your web page. The line where your javascript is, should end with a question mark and a number.
For instance, if you are using the default name application.js, open your webpage source and check if it looks like this:
http://www.example.com/javascripts/application.js?1311166541
The ?1311166541 tells you that your javascript was found and it's loaded by the page.
If it's still not working, the problem is inside your javascript file and it has nothing to do with Ruby on Rails.
If you are using Rails 3, there will not be a number after the filename, but just before the .js. Something like /assets/application-447c72e0609e769e6d9601ff3e930fdc.js. The principle is the same.