3

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

8

Try this instead:

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

6

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

4
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 you have read our privacy policy.

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