[%splitstr] Please add regex support as second argument

0 votes
asked Apr 5 in Wanted features by kasra (1,040 points)


It would be great to have regex support.

Like the String.prototype.split() function in js.

It will permit some powerful capabilities, like making easy the creation of a mindmap of a API 

Let's say I want to split a string that is written is PascalCase. With regex thanks to positive lookahead

it's direct : s.split(/(?=[A-Z])/) .

example :  "SomeDumbExemple" 

result : ["Some","Dumb","Exemple"]

Thanks for your feedback 

commented Apr 9 by The-Lu (67,040 points)

Hello K.,

Good new feature request...

I can propose a PR.


commented Apr 9 by kasra (1,040 points)
yes please it would be great to have this !

Thanks for your help.

1 Answer

+1 vote
answered Apr 9 by The-Lu (67,040 points)
selected Apr 9 by kasra
Best answer

Hello K., and all,

It now done with the last snapshot:

We can now use:

%splitstrregex("FooBar", "(?=[A-Z])") -> ["Foo","Bar"]


commented Apr 10 by The-Lu (67,040 points)

Hello K., and all,

In fact the name `%splitstrregex` is not so good...sad

As proposed by plantuml, here are some new proposals for change:

  • %split_str_regex
  • %splitstr_regex
  • %split_by_regex
  • %split_regex_separator
  • %split_regex_sep

What is the best for you...? enlightened
Before to change on the main repo.


commented Apr 10 by kasra (1,040 points)

Consistency is the most important for me.

we already have %splitstr  so maybe %splitstr_regex ?

Thanks for your work !!

commented Apr 12 by The-Lu (67,040 points)

Considered sold,... cheeky

Therefore it will be %splitstr_regex !

(Available on the last snaphot)