11

I'm having a bit of trouble here with this situation.

enter image description here

I want "NumeroCamp" only to have the numbers are showing in "Text".

Is there any function in field calculator that could help me with that?

4
  • 1
    See this question here: gis.stackexchange.com/questions/127415/…
    – MaryBeth
    Feb 13 '17 at 13:22
  • I want to create a new field in my attribute table by returning all digits between the / and _ characters of the field named "location" by aplying the expression given by @ArMoraer to my situation: regexp_substr( "Text", '/(\\d*)\_' ) However, it does not give the desired result: ![enter image description here](i.stack.imgur.com/92zAd.png) How could I adapt the expression to my case? Many hanks in advance to anyone who can help or give any suggestions.
    – abrobia
    Sep 4 '18 at 17:26
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – BERA
    Sep 4 '18 at 18:29
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review
    – Vince
    Sep 4 '18 at 20:18
18

You can use the following expression in the field calculator (tested on QGIS 2.18):

regexp_substr( "Text", ';(\\d*)\}' )

This will return all digits (as text) between the ; and } characters.

0
1
string_to_array("text",';')[1]

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.