Sinisterly
What text recognition should I support? - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: What text recognition should I support? (/Thread-What-text-recognition-should-I-support)



What text recognition should I support? - NoahWatchmaker - 05-16-2016

When a user enters a new message into the chat, I want links to be clickable, and also anything that reads "youtubeConfusedmosh" or "twitter:jack" or "instagram:kim" I want to be a link.
I know how to support the above two. Yeah, I got that.

BEfore I program this huge monster for supporting those two, what else should I support? I really can't think of anything.
I Mean. i already have @mentions to other posts, and to other _users as well.
I'm trying to think of what else... I don't think there is anything.

great. this is going to be adhoc as fuck.


what other http:// , https:// protocols are there? I mean... people don't usually use other protocols when hyper linking.


RE: What text recognition should I support? - Killpot - 05-16-2016

What language are you doing this in? And it sounds like all you would need is three different regex expressions and some simple string building.


RE: What text recognition should I support? - meow - 05-16-2016

(05-16-2016, 05:01 PM)NoahWatchmaker Wrote: what other http:// , https:// protocols are there? I mean... people don't usually use other protocols when hyper linking.

You really don't have to worry about wrappers other than those. However, it's important to create a white-list or something of the sort, you don't want this happening - https://www.bishopfox.com/blog/2016/04/if-you-cant-break-crypto-break-the-client-recovery-of-plaintext-imessage-data/


RE: What text recognition should I support? - Inori - 05-16-2016

not entirely sure what you're getting at here, but if you're asking how to support it, use regex and replace with <a> tags with the link inside. As for other protocols, there's git://, ftp://, and sftp://. Probably more, but those are the only one's I've seen used.


RE: What text recognition should I support? - 0xDEAD10CC - 06-19-2016

Those "protocols" are defined within the Windows registry for Windows users, things like torrent links, irc links are all created by program installations. They aren't truly really protocols as much as they are "mappings", but if this is what you're trying to do from your program, you should just use regex. There's nothing here that regex can't achieve.


RE: What text recognition should I support? - Wildfire - 06-21-2016

Basically what 0xDEAD10CC said. Presuming this is a web application, it would be trivial to use a bit of JavaScript to convert these "pseudo-links" into actual URLs to services, e.g. http://twitter.com/{0}. Regex, or if you're lazy, indexOf() and split(), then switch(), will do the job.


RE: What text recognition should I support? - NoahWatchmaker - 06-22-2016

(06-21-2016, 11:56 PM)Axari Wrote: Basically what 0xDEAD10CC said. Presuming this is a web application, it would be trivial to use a bit of JavaScript to convert these "pseudo-links" into actual URLs to services, e.g. http://twitter.com/{0}. Regex, or if you're lazy, indexOf() and split(), then switch(), will do the job.

Yeah. i'll have to learn regex. what a drag.


RE: What text recognition should I support? - Wildfire - 06-22-2016

(06-22-2016, 05:03 AM)NoahWatchmaker Wrote:
(06-21-2016, 11:56 PM)Axari Wrote: Basically what 0xDEAD10CC said. Presuming this is a web application, it would be trivial to use a bit of JavaScript to convert these "pseudo-links" into actual URLs to services, e.g. http://twitter.com/{0}. Regex, or if you're lazy, indexOf() and split(), then switch(), will do the job.

Yeah. i'll have to learn regex. what a drag.

Hey now, Regex is a very good skill to have. Besides, if you really wanted to resist, my way would also work.