Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect URLs #12

Closed
farling42 opened this issue Oct 18, 2017 · 3 comments
Closed

Detect URLs #12

farling42 opened this issue Oct 18, 2017 · 3 comments

Comments

@farling42
Copy link
Owner

When importing text, detect URLs and automatically put the correct markers around them.

@farling42
Copy link
Owner Author

farling42 commented Nov 15, 2017

An example of what actually appears in the RWexport file (after decoding):

<p class="RWDefault"><span class="RWSnippet">Here is some text with an embedded <a class="RWLink" style="color:#000000;text-decoration:none" href="http://www.amusingtime.uk/" title="http://www.amusingtime.uk/"><span class="RWLink">http://www.amusingtime.uk/</span></a></span><span class="RWSnippet"> within it.</span></p>

At the beginning of a snippet, it appears as:

<p class="RWDefault"><span class="RWLink" style="color:#000000"><a class="RWLink" style="color:#000000;text-decoration:none" href="http://amusingtime.uk/somedir?query" title="http://amusingtime.uk/somedir?query"><span class="RWLink">http://amusingtime.uk/somedir?query</span></a></span><span class="RWSnippet"> appears at the start of the lien.</span><span class="RWSnippet">&nbsp;</span></p>

@farling42
Copy link
Owner Author

One possible RegExp which will detect a URL is:

((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?

obviously the first bit can be replaced by something that finds any sequence of letters.

@farling42
Copy link
Owner Author

Implemented in V1.14

The regular expression used to match a URL might need improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant