Tinderbox Forum

Help exploding notes

I have a list in $Text that I want to explode. Every time I explode it $Name is getting an extra line break, which I then have to remove with a stamp.

Original list:

Exploded list:

Any idea why my names are getting the extra link break? What would you suggest as the action to make this stop?

Also, I’m having trouble figuring out the RegEx for the following action. When I explode the text I want the Name to be the title, the info between the ( ) to go into $Organization and the ( ) and the space after the name to be deleted. Ideas?

I’ve figure out how to remove the extra line break. I just have to delete the deliminator. Pretty obvious now that I think about it. I’m still struggling with parsing the data, though.

Does Tinderbox support something opposite of .replace? For example, I figure out the regex to copy the text I want e.g. (?<=().?(?=)). This copies the text between the ( ). But, I don’t want to delete it, rather I want to use it and put it in an attribute. As for getting the first name, I have the regex get that too, ^[^(]. I can run a grep command to get that, runCommand(“grep -o ‘^[^(]*’”,$Text);, but I can’t figure out how to delete the trailing space. Ah…so close and yet so far away. :-).

Anyone have ideas?

I don’t think it can be done in one go. I set Explode to use ‘First paragraph’ and ‘Omit text’ and this action:

$Text = $Name.replace("([^\(]+)\(([^\(]+)\)",$2);
$Name=$Name.replace("([^\(]+)\(([^\(]+)\)",$1);

The titlename gets correctly trimmed but $Text is incorrect. Late her, but the above should point you in the right direction.

See also Query back-references.

Thanks.
You’re $Name string helped, the first one did not.

This worked, almost (super close).

$Name=$Name.replace("([^\(]+)\(([^\(]+)\)",$1);$Organization=$Text.replace("^[^\(]*",$2);

Now what I want to be able to do is automatically remove the trailing space on the name and delete the ( ) in organizations. Can’t figure this out at all.

You’re right - you caught me as I was turning in. After more testing this works for me as the $OnAdd for the ‘exploded notes’ prototype. IOW, Explode as above but with no action. The $OnAdd is:

$Text = $Name.replace("[^\(]+\(([^\(]+)\)",$0);
$Name = $Name.replace("([^\(]+) \(.*",$0);

See this test: Explode-renamer.tbx (86.6 KB)

1 Like

HI @satikusala,

If I may ask, how did you remove the delimitor ?

Sure, great question. When you go to explode a note, go to the Note Menu and select Explode, in the corresponding popup you can have Tinderbox delete the delimiter after it explores the note. I’ll do a video on this once I ask Mark a couple questions. I need some help for the advanced Part 2.
image

Thank you so much ! It was right there and I missed the option.