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.

Hi, Michael

I’m stuck in the same problem even if I delete the delimitator, which is ## .

If I explode by paragraph, no problem.

It always worked really well in the past…

Why don’t you show us the data you’re trying to explode?

I imported this document. But I tried also with a document created in Tinderbox and got the same effect




The “Teste 3” has no space line at the end and a space was inserted at the beginning.

It would be better to either (a) paste the text to be exploded here, or (b) put the note you want to explode into a Tinderbox document, and share the file here.

The less time people have to spend to reproduce your problem, the more time they can spend solving it.

(In the interim, there new .trim() operator might be helpful.)

The fact the titles wrap for ‘Teste 1’ and ‘Teste 2’ would suggest you delimiter is not working as imagined. Sadly in your first screengrab of the test file, the o=pop-up coders the source text, so we can’t se what actual $Text you are exploding.

Can you upload your test document? The result suggests there is other content (non-visible characters?) that are throwing off the result

Noodling around, I do observe that in text link this, the title is being chosen to include the closing carriage return. That’s probably undesirable.

It’s easy to use .trim() to get rid of the undesired return, but I wonder whether Explode should implicitly trim whitespace before and after the title.

I suspect it is desirable in most cases, but problematic in a lesser number. Thus, perhaps the default for a new explode panel option?

Teste.tbx (80.6 KB)

Every document I create has the same question.

Thanks, the TBX helps a lot!

OK, you’re using ‘first sentence’ except your titles (to be) have no sentence as such - i.e. no terminating punctuation. Use ‘first paragraph’ and all this goes away. If I look at your original screen grab your markers they are single unpunctuated titles, i.e a single ‘paragraph’ of text.

The Explode set-up didn’t survive in the test do but I’d note your custom explode delimiter is two hashes and a space## ’. If you omit the space, your titles retain the space for the original text at the start of the exploded title. currently, that isn’t auto-trimmed. Regex are very precise in that manner :slight_smile:

@eastgate, some old issues seem to have crept back in that titles aren’t being extracted correctly. I recall this was an issue but then got fixed (until now!). I amended the test note $Text to;

## Teste 1. More stuff.

## Teste 2. This stuff.

## Teste 3. That stuff.

Exploding on a removed delimiter of ‘## ’ and selecting ‘First sentence’ as the title, and removing titles from text, I get correct titles , e.g. ‘Teste 1.’, ‘Teste 2’, etc. but the $Text in each case is missing the first character. So the $Text of exploded note ‘Teste 1.’ is:

ore stuff.

but it should be:

More stuff.

Odd, but I guess it possibly connected with the ‘sentence’ detection algo.