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"?

  • Will the structure of your field always be that 'simple' ? – snaileater Jan 29 at 9:43
  • yes, always pvc400, pvc200, ac200... – Franziska-Posch Jan 29 at 9:46
7

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"

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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