Destination Mask: Grab parts before/after string? [#19346][#19347]

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Destination Mask: Grab parts before/after string? [#19346][#19347]

Re: Destination Mask: Grab parts before/after string? [#19346][#19347]

by Peke » Wed Sep 21, 2022 4:41 pm

Hi,
$COUNT is not much important, you can still get that, but bit more complex.

Glad you liked it.

Happy Monkeying!

Re: Destination Mask: Grab parts before/after string? [#19346][#19347]

by manalive » Wed Sep 21, 2022 4:32 pm

I've been using this in 2662 and it's great!

I think my last suggestion is turning out to be relevant-

$POS should accept a third parameter for nth instance of the string. Right now we can only get the first and last instance of the string.

I would also recommend a COUNT function to find out how many times it occurs.

Combining $IF, $Len, $Left/$Right/$Mid with $POS and $Count means you have a complete system and can grab any string without resorting to RegEx.

Re: Destination Mask: Grab parts before/after string? [#19346]

by Peke » Fri Sep 02, 2022 3:29 pm

Hi,
Good catch. I added $POS as https://www.ventismedia.com/mantis/view.php?id=19347 as Wishlist.

EDIT: I expanded it with $LAST mask to get position of last found String within a string

Re: Destination Mask: Grab parts before/after string? [#19346]

by manalive » Fri Sep 02, 2022 3:10 pm

Wow, thank you for adding this!

It looks like your method of doing it is to allow Left and Right to use a string instead of a number and just grab everything after that string. That will give me what I want for my use case.

But I would also suggest that you add a function that returns the position of the Nth instance of a character or string. This would allow users to grab anything from any value available when combined with the other functions.

Re: Destination Mask: Grab parts before/after string?

by Peke » Fri Sep 02, 2022 2:48 pm

Hi,
I found this inspiring, so I added it as https://www.ventismedia.com/mantis/view.php?id=19346

Re: Destination Mask: Grab parts before/after string?

by Lowlander » Fri Sep 02, 2022 1:14 pm

No, the options aren't as extensive as in programming. RegExp was a good way to achieve this, but it hasn't been updated for MediaMonkey 5.

Destination Mask: Grab parts before/after string? [#19346][#19347]

by manalive » Fri Sep 02, 2022 12:55 pm

Is there a way to grab X characters before the ":" in an album title, for example?

From the help page (https://www.mediamonkey.com/wiki/WebHel ... ormats/5.0) I see you can grab Right, Left, Mid and calculate Length. Usually formula systems have a way to find where a character or string is in a value so you can pull it out with the other functions.

Top