Skip to Content
0

extract specific character from string

Sep 25, 2017 at 03:13 PM

34

avatar image
Former Member

Hello Experts,

I am trying to extract specific character from a string field. Data format example:

/southwest/science/samuel, john, 23445/

/northwest/english/larry, dan, 38543/

from above i just need to extract Science and English.

Your help will be appreciated.

Thanks

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ian Waterman Sep 26, 2017 at 08:10 AM
0

Assuming they are always in front of the third / this will give you what you want, replace text with your field

split('/southwest/science/samuel, john, 23445/','/')[3]

Ian

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Ian,

Thanks for the quick response, is there a way to count it from the reverse order? Some of the records have blank spaces before /.

0

try (all single quotes in example), this remove spaces before doing split

split(replace({yourfield},' ', ''),'/')[3]

Ian

0