Javascript http regex JavaScript HTTP regular expression
I asked this on Stackoverflow, however I was informed that the type of question was not really fit for there, which I understand.
I am currently using the following to convert [url=][/url]
to a htmlan HTML link:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
That work's fine.
I then added on another replace function using a regexregular expression to replace www
with http://www
like so:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
.replace(/www/g, "http://www");
This is probably not the best/efficient method and also does not support https://
which is not a priority at the moment, but it is something I would like to include at some point. Could someone please advise me on what IWhat could I do to improve the regexregular expression?
I asked this on Stack Overflow. However, I was informed that the type of question was not really fit for there, which I understand.
Javascript http regex
I asked this on Stackoverflow, however I was informed that the type of question was not really fit for there, which I understand.
I am currently using the following to convert [url=][/url]
to a html link:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
That work's fine.
I then added on another replace function using a regex to replace www
with http://www
like so:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
.replace(/www/g, "http://www");
This is probably not the best/efficient method and also does not support https://
which is not a priority at the moment but is something I would like to include at some point. Could someone please advise me on what I could do to improve the regex?
JavaScript HTTP regular expression
I am currently using the following to convert [url=][/url]
to an HTML link:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
That work's fine.
I then added on another replace function using a regular expression to replace www
with http://www
like so:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
.replace(/www/g, "http://www");
This is probably not the best/efficient method and also does not support https://
which is not a priority at the moment, but it is something I would like to include at some point. What could I do to improve the regular expression?
I asked this on Stack Overflow. However, I was informed that the type of question was not really fit for there, which I understand.
Javascript http regex
I asked this on Stackoverflow, however I was informed that the type of question was not really fit for there, which I understand.
I am currently using the following to convert [url=][/url]
to a html link:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
That work's fine.
I then added on another replace function using a regex to replace www
with http://www
like so:
s = message.replace(/\[url=([^\]]+)\]\s*(.*?)\s*\[\/url\]/gi, "<a href='1ドル'>2ドル</a>")
.replace(/www/g, "http://www");
This is probably not the best/efficient method and also does not support https://
which is not a priority at the moment but is something I would like to include at some point. Could someone please advise me on what I could do to improve the regex?