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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
  • 1
    See this question here: http://gis.stackexchange.com/questions/127415/how-to-split-a-text-attribute-by-characters-in-qgis-2-6-0 – 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 How could I adapt the expression to my case? Many hanks in advance to anyone who can help or give any suggestions. – abrobia Sep 04 '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 04 '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 04 '18 at 20:18

2 Answers2

19

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.

ArMoraer
  • 5,649
  • 2
  • 26
  • 48
1
string_to_array("text",';')[1]
MrXsquared
  • 34,292
  • 21
  • 67
  • 117
LM10
  • 436
  • 2
  • 7