Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Stuck on regex agent/action problem (Read 2993 times)
mrkwr
Full Member
*
Offline



Posts: 75

Stuck on regex agent/action problem
Jul 14th, 2013, 12:21pm
 
I have a tbx document where I log my reading: the books I plan to read and those I have read.

In order to add books I drag in the URL from the book's Amazon page, which captures the URL and also encodes the author/title information as follows

    title: Amazon.co.uk: author: Books

To save retyping I made an Agent with the following regex query

    $Name((.+): (.+): (.+): )  

and this action ($Title and $Author are user-defined string attributes)

    $Title=$1;$Author=$3

This has worked fine* since mid-2008 when I built the document but today seems to have stopped working. I'm at a loss to know why – has something changed in Tbx??

-Mark

* PS: I know it doesn't catch books with title:subtitle in the webpage name, but I figured it was easier to handle these exception manually than to try to figure out the code to test for and handle separately. It shouldn't be terribly difficult – just count the semi-colons
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Stuck on regex agent/action problem
Reply #1 - Jul 14th, 2013, 12:37pm
 
Likely because you're using deprecated syntax in your query. Instead of $AttrName(pattern) it is expected that you use $AttrName.contains("pattern"). Note that in the latter the patter must be enclosed in quotes. Thus the query becomes:

$Name.contains("(.+): (.+): (.+): ")

The above works for me in v5.12.1, whilst your old-style code doesn't. See more on String.contains().

I assume $Title and $Author are custom attributes. For v5.110 only there was briefly a system attribute $Title before it was replaced by $ReferenceTitle in v5.11.1 because 'title' used as a descriptor for the $Name of notes and thus might confuse newer users. TB v5.11 introduced the new Reference group of system attributes as part of integrating drag-drop from Bookends.
Back to top
 
« Last Edit: Jul 14th, 2013, 12:38pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
mrkwr
Full Member
*
Offline



Posts: 75

Re: Stuck on regex agent/action problem
Reply #2 - Jul 14th, 2013, 4:22pm
 
Mark, many thanks, that's fixed it in one!
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print