View Single Post
Old 09-10-2017, 06:32 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Try
Code:
{comment:'re($, '(https?://www.fanfiction.net/s/[^/]*/1/)', strcat('<p class="description"><a href="\1">',  field('title'), '</a></p>'))'}
as the template.

The four changes:
  • I moved the test for the 's' in https to where it belongs.
  • The original example you gave me had a /u/ in it. Now it has a /s/ in it. The pattern was changed to account for that.
  • Now that there is always a /1/ at the end of the URL, the capture for the id number can be simplified.
  • Add a missing " at the end of the URL
For those who come along later to offer improvements (I am sure there are many), she wants to convert a URL of the form
Code:
http://www.fanfiction.net/s/1962402/1/
to the form
Code:
<p class="description"><a href="http://www.fanfiction.net/s/1962402/1/">{title of book}</a></p>
chaley is offline   Reply With Quote