cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
lala
Level VIII

How will the row characters be matched from left to right to the last decimal point using the re?

 

 

So what's left over on the right-hand side is the non-green part of each row.

 

Thanks!

20220516212519.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Craige_Hales
Super User

Re: How will the row characters be matched from left to right to the last decimal point using the re?

I think you are asking for a regex to match all but the last segment.

regex("aaa.bbb.ccc.ddd","([^\.]+\.)+")

aaa.bbb.ccc.

 

[^\.] means a single character that is not a period

[^\.]+ means one or more of those characters

[^\.]+\. means match the period

([^\.]+\.)+ means do all that one or more times

Craige

View solution in original post

Craige_Hales
Super User

Re: How will the row characters be matched from left to right to the last decimal point using the re?

regex is not the best way to attack this problem.

 

word(-1,"aaa.bbb.ccc.this is it",".") // "this is it"

will get the last segment efficiently.

 

word([1 -2],"aaa.bbb.ccc.this is it",".") // "aaa.bbb.ccc"

will get the left part efficiently.

 

Craige

View solution in original post

3 REPLIES 3
Craige_Hales
Super User

Re: How will the row characters be matched from left to right to the last decimal point using the re?

I think you are asking for a regex to match all but the last segment.

regex("aaa.bbb.ccc.ddd","([^\.]+\.)+")

aaa.bbb.ccc.

 

[^\.] means a single character that is not a period

[^\.]+ means one or more of those characters

[^\.]+\. means match the period

([^\.]+\.)+ means do all that one or more times

Craige
lala
Level VIII

Re: How will the row characters be matched from left to right to the last decimal point using the re?

na1=Regex("aaa.bbb.ccc.ddd","[^\..]+$");
Craige_Hales
Super User

Re: How will the row characters be matched from left to right to the last decimal point using the re?

regex is not the best way to attack this problem.

 

word(-1,"aaa.bbb.ccc.this is it",".") // "this is it"

will get the last segment efficiently.

 

word([1 -2],"aaa.bbb.ccc.this is it",".") // "aaa.bbb.ccc"

will get the left part efficiently.

 

Craige