cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
dadawasozo
Level V

split long string based on position of delimiter

Hi

I have a column that has long strings (see example below). I want to extract all the text after the 7th delimiter of "_"  from the right. I tried munger but doesnt seem working well at the end part.

 

can someone provide suggestion how I can do it right?

 

1)shjdjsh._ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a

desired output: ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a
2)hhd_wew_klf:_jdbfjdf_qwkokv_ctls_msdn_a_f_g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf
desired output: g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: split long string based on position of delimiter

You could use Word() with negative indices

Names Default To Here(1);

str1 = "shjdjsh._ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a";
result1 = "ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a";

str2 = "hhd_wew_klf:_jdbfjdf_qwkokv_ctls_msdn_a_f_g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf";
result2 = "g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf";

res1 = Word([-8 -1], str1, "_");
res2 = Word([-8 -1], str2, "_");

res1 == result1;
res2 == result2;
-Jarmo

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: split long string based on position of delimiter

Here is the formula I used

Substr(
	:Column 1,
	Contains( :Column 1, Word( -8, :Column 1, "_" ) )
)

txnelson_0-1719069880382.png

 

Jim
jthi
Super User

Re: split long string based on position of delimiter

You could use Word() with negative indices

Names Default To Here(1);

str1 = "shjdjsh._ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a";
result1 = "ndjrpe_hfkjd_tyrwytre5_hlhm_jgds.d._jkdjf_hfkd_a";

str2 = "hhd_wew_klf:_jdbfjdf_qwkokv_ctls_msdn_a_f_g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf";
result2 = "g_skjd_lad_vtl_sdjnskjshdja_jndf_skdj_ccf";

res1 = Word([-8 -1], str1, "_");
res2 = Word([-8 -1], str2, "_");

res1 == result1;
res2 == result2;
-Jarmo

Recommended Articles