AnsweredAssumed Answered

Split field on first number

Question asked by Dcamrine on Jan 14, 2016
Latest reply on Jan 15, 2016 by Dcamrine
Branched from an earlier discussion

Edit (by Xander Bakker): the original question was placed at this thread: Extracting an integer from a string field but I decided to branch it to a new thread.



I have a similar situation...


For Example:

s ="POWERS 1C-23HZ"

and some are like s2 = RATTLER4C-34HZ


I would like to tell python to find the first number in each field and then split the field at the same location at the first number. so....

Field 1 = RATTLER

Field 2 = 4C-34HZ


derived from the string above: s2

I would like to use the field calculator to do this.



I know you can use this to split on the space:

!field! = s.split(' ')[0]


I did this in the field calculator expression box and it works but only on the strings with a space where I need to break it.


Any help is much appreciated!

Dan A.


Message was edited by: Xander Bakker. Post branched to new Thread