I´m working with QGIS 2.12. Is it posible to split string "from the right side" (it means I needed the last text from every field)?
In one field I have description like:
new street 25
old street 2
lower 26A
lower new street 125
Jozefs and Elisabeths new gardens 147A
Every line has a different count of texts. I needed a column with numbers:
25
2
26A
125
147A
Could be possible in QGIS?
Answer
You can do it using the following formula in the Field Calculator:
regexp_substr("Field_Name",'(\\d+|\\d+.+)')
Where:
The first \
is to escape \d
\d+
: means extract one or more digits.
|
: means OR.
\d+.+
: means extract one or more digits and one or more any other character.
It will give you the following results:
25
2
26A
125
147A
Even if you have text with a name 'Text 123456789ABCDEF', the output will be:
123456789ABCDEF
No comments:
Post a Comment