Hi, converters are just simple C functions, (or could be Lua code as well), and are quite trivial to write. Instead of creating a converter that reverse the order of chars in a string, I would rather patch current "word" converter to support negative integers. IE: -2 would means you extract the second word, starting at the end of the string.
Baptiste On Mon, Jun 25, 2018 at 12:29 PM, Daniel Schneller < daniel.schnel...@centerdevice.com> wrote: > Hi! > > Just double checking to make sure I am not simply blind: Is there a way to > reverse a string using a sample converter? > > Background: I need to extract just the second level domain from the host > header. So for sub.sample.example.com I need to fetch "example". > > Using the "word" converter and a "." as the separator I can get at the > individual components, but because the number of nested subdomains varies, > I cannot use that directly. > > My idea was to just reverse the full domain (removing a potential port > number first), get word(2) and reverse again. Is that possible? Or is there > an even better function I can use? I am thinking this must be a common use > case, but googling "haproxy" and "reverse" will naturally turn up lots of > results talking about "reverse proxying". > > If possible, I would like to avoid using maps to keep this thing as > generic as possible. > > Thanks a lot! > > Daniel > > > -- > Daniel Schneller > Principal Cloud Engineer > > CenterDevice GmbH > Rheinwerkallee 3 > 53227 Bonn > www.centerdevice.com > > __________________________________________ > Geschäftsführung: Dr. Patrick Peschlow, Dr. Lukas Pustina, Michael > Rosbach, Handelsregister-Nr.: HRB 18655, HR-Gericht: Bonn, > USt-IdNr.: DE-815299431 > > Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche > und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige > Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren > Sie bitte sofort den Absender und löschen Sie diese E-Mail und evtl. > beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder > Öffnen evtl. beigefügter Dateien sowie die unbefugte Weitergabe > dieser E-Mail ist nicht gestattet. > > >