Skip to main content
code format for readability
Source Link
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

I had a similar need to extract a variable length string from within a longer string, but where the left and right lengths of characters to be removed from the source string were fixed (but not necessarily the same).

I used this expression in the field calculator for the new string:

Left(RIGHT([field],Len([field] )-N1),Len(RIGHT([field],Len([field] )-N1))-N2)

Left(RIGHT([field],Len([field] )-N1),Len(RIGHT([field],Len([field] )-N1))-N2)

Where:

  • [field] = source string
  • N1 = number of characters to remove from the left of the string
  • N2 = number of characters to remove from the right of the string

I had a similar need to extract a variable length string from within a longer string, but where the left and right lengths of characters to be removed from the source string were fixed (but not necessarily the same).

I used this expression in the field calculator for the new string:

Left(RIGHT([field],Len([field] )-N1),Len(RIGHT([field],Len([field] )-N1))-N2)

Where:

  • [field] = source string
  • N1 = number of characters to remove from the left of the string
  • N2 = number of characters to remove from the right of the string

I had a similar need to extract a variable length string from within a longer string, but where the left and right lengths of characters to be removed from the source string were fixed (but not necessarily the same).

I used this expression in the field calculator for the new string:

Left(RIGHT([field],Len([field] )-N1),Len(RIGHT([field],Len([field] )-N1))-N2)

Where:

  • [field] = source string
  • N1 = number of characters to remove from the left of the string
  • N2 = number of characters to remove from the right of the string
Source Link

I had a similar need to extract a variable length string from within a longer string, but where the left and right lengths of characters to be removed from the source string were fixed (but not necessarily the same).

I used this expression in the field calculator for the new string:

Left(RIGHT([field],Len([field] )-N1),Len(RIGHT([field],Len([field] )-N1))-N2)

Where:

  • [field] = source string
  • N1 = number of characters to remove from the left of the string
  • N2 = number of characters to remove from the right of the string