2

I'm attempting to remove € symbols from values in the attributes of a geopackage. For example, I have a value 240 123€ that I want to turn into 240 123.

I'm using the field calculator to do this. So far here's what I have written down. regexp_replace("myfield",'(^.*[0-9]+)','\\1')

This gives the same results as regexp_replace("myfield",'([0-9]+)','\\1')

Both of these result in 240 123€.

1
  • note that if you want to turn the value in a "real" number you will need to remove the space (thousand separator) as well...
    – J.R
    Nov 15, 2022 at 15:55

3 Answers 3

7

Try this instead:

replace("field_name", '€', '')

6

Why so complicated? Simply use: regexp_replace("myfield",'€','') - or even easier: replace("myfield",'€','')

3
left("text",length("text")-1)

would work, too.

2
  • 2
    ...if the symbol to be removed is at the same place all time
    – Babel
    Nov 15, 2022 at 14:01
  • 2
    I can only work with what OP provides to us @Babel ;-)
    – Erik
    Nov 15, 2022 at 14:13

Your Answer

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

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