[Qgis-user] replace '\' problem

Werner Macho werner.macho at gmail.com
Wed Jun 30 07:08:19 PDT 2021


Hi,
As David already mentioned... Backslash is a special character and has to
be treated special.

Therefor you would have to write

replace("field", '\\', '.')

to replace a single backslash with a dot ..

special characters have to be "escaped"

Probably see
https://en.wikipedia.org/wiki/Escape_character
to find out.

regards
Werner

On Wed, Jun 30, 2021 at 3:46 PM Marcos <marcos.ummus at gmail.com> wrote:

> Thank you for your comment, David,
>
> I will try to make myself clear: when I wrote the snippet "*replace("field",
> '\', '.')*" at the field calculator, it doesn't return anything, that is,
> the fields are not replaced.
> Does anyone have any idea why?
>
> Thanks to the whole community, I learn a lot from you!
>
> David Strip <qgis-user at stripfamily.net> escreveu no dia terça, 29/06/2021
> à(s) 23:50:
>
>> On 6/29/2021 5:28 PM, Marcos wrote:
>>
>> I was trying to replace the '\' using the *replace () *function, but it
>> didn´t work anyway.
>> It's probably a standard/default problem or a 'reserved (not a) word'.
>>
>> Just a guess, but \ is commonly used to indicate special characters. eg,
>> \n = newline.
>> Try using \\
>>
>
>
> --
> Marcos Eichemberger Ummus
> Tel.: +55 (11) 9-4860-8441
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210630/00117af8/attachment-0001.html>


More information about the Qgis-user mailing list