[Rpm-maint] [rpm-software-management/rpm] Any way to work around %gsub's (Lua-originating) escaping requirements regarding the input string? (Discussion #3826)

Frank Dana notifications at github.com
Sat Jun 21 05:21:55 UTC 2025


Aaaand, I just realized I'm not actually _escaping_ the periods in the source string at all, I'm just still doing pattern substitution with `.` wildcards:

```lua
> string.gsub("1\\_2\\_3", "\\.", ",")
1,2,3	2
```

...So if I can figure out the correct way to _actually_ quote the pattern period, it'll probably work without manipulating the source string. But what _is_ the correct way? A single backslash doesn't do it, that's a syntax error:

```lua
> string.gsub("1.2.3", "\.", "_")
stdin:1: invalid escape sequence near '"\.'
```

Ah. That should've been obvious, my bad:

```lua
> string.gsub("1.2.3", "%.", "_")
1_2_3	2
```

...Neeeeevermind.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/3826#discussioncomment-13535853
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/3826/comments/13535853 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20250620/0fb80c00/attachment-0001.htm>


More information about the Rpm-maint mailing list