Search code examples
regextftp

Replace string by regex for tftp


I want to use tftp-hpa file-remapping feature (see the man page). It uses regex, but it doesn't have much functionality. What I want is when the client send a request for foo, the server send client_IP/foo. For the moment I have this rule :

r foo \i/foo

But as you can guess, it works only for foo, whereas I want it to work whatever is the request. I've tried this :

r /.*/ \i//.*/

But it doesn't work. As the documentation and the examples aren't much, I don't know what to try, so maybe you can have some suggestions. (So yeah, I know it's not really a programing question, but as programmers you know regex and maybe you'll have the good answer)


Solution

  • Looks like you need to use a replacement pattern: As stated in the doc, \0 stands for the "entire string matched by the regex". So try:

    r .* \i/\0