4

I have a huge sewer network with pipe information, labelled for example as "pvc400" (where material=Pvc and diameter=400). Is it possible to split up the information into text and numbers only, so that i create two new columns, 1 with information about material "pvc" and one with the diameter "400"?

2
  • Will the structure of your field always be that 'simple' ?
    – Snaileater
    Commented Jan 29, 2020 at 9:43
  • yes, always pvc400, pvc200, ac200... Commented Jan 29, 2020 at 9:46

1 Answer 1

6

To calculate that fields you can use regex function regexp_substr(). In the field calculator create new field with expressions:

  1. For retrieving text characters (non-digits)

    regexp_substr("your_field",'(\\D+)')
    

This takes from "pvc400" only "pvc"

  1. For retrieving numbers (digits) with

    regexp_substr("your_field",'(\\d+)')
    

This takes from "pvc400" only "400"

1
  • wow, thanks a lot!! works perfectly Commented Jan 29, 2020 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.