I have some text I want to linkify, which I can reasonably do with a regex (search for http/https or www) but I'm worried about XSS complications. What's a safe way to do this in Perl?
相关问题
- React Native Inline style for multiple Text in sin
- $ENV{$variable} in perl
- Set BaseUrl of an existing Pdf Document
- UrlEncodeUnicode and browser navigation errors
- Improve converting string to readable urls
相关文章
- How to get rid of border around and image used as
- Running a perl script on windows without extension
- Comparing speed of non-matching regexp
- Removing the href attribute
- Can NOT List directory including space using Perl
- Extracting columns from text file using Perl one-l
- Lazy (ungreedy) matching multiple groups using reg
- How do I tell DBD::mysql where mysql.sock is?
I can't speak to the XSS issue, but URI::Find will let you find all URIs in text and transform them into whatever you like.
Exactly what do you mean by XSS complications? Are you only concerned with JavaScript or do URLs of the form http://example.com/command?type=delete;who=sam etc concern you as well?
As for linkifying URLs, there will always be edge cases, but Text::Markdown worked pretty well on a variety of inputs when I tried it. You can use the urls method to preprocess the links.
See also Regexp::Common.