PageSourceSearch

https://docs.rspamd.com/assets/js/fc2d5af7.f0e40509.js

js rspamd.com collected 2026-10-02 02:31:35 UTC 38,775 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkrspamd_docs=self.webpackChunkrspamd_docs||[]).push([[8267],{28453:(e,n,s)=>{s.d(n,{R:()=>i,x:()=>c});var r=s(96540);const d={},t=r.createContext(d);function i(e){const n=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:i(e.components),r.createElement(t.Provider,{value:n},e.children)}},84365:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>c,default:()=>x,frontMatter:()=>i,metadata:()=>r,toc:()=>h});const r=JSON.parse('{"id":"lua/rspamd_text","title":"Module rspamd_text","description":"Module rspamd_text","source":"@site/docs/lua/rspamd_text.md","sourceDirName":"lua","slug":"/lua/rspamd_text","permalink":"/lua/rspamd_text","draft":false,"unlisted":false,"editUrl":"https://github.com/rspamd/docs.rspamd.com/edit/master/docs/lua/rspamd_text.md","tags":[],"version":"current","frontMatter":{"title":"Module rspamd_text"},"sidebar":"docs","previous":{"title":"Module rspamd_tcp","permalink":"/lua/rspamd_tcp"},"next":{"title":"Module rspamd_trie","permalink":"/lua/rspamd_trie"}}');var d=s(74848),t=s(28453);const i={title:"Module rspamd_text"},c=void 0,l={},h=[{value:"Module <code>rspamd_text</code>",id:"mda0fc",level:2},{value:"Brief content:",id:"brief-content",level:3},{value:"Functions",id:"functions",level:2},{value:"Function <code>rspamd_text.fromstring(str)</code>",id:"f9e388",level:3},{value:"Function <code>rspamd_text.null()</code>",id:"fe3c3c",level:3},{value:"Function <code>rspamd_text.randombytes(nbytes)</code>",id:"fa6e4a",level:3},{value:"Function <code>rspamd_text.fromtable(tbl[, delim])</code>",id:"f01366",level:3},{value:"Methods",id:"methods",level:2},{value:"Method <code>rspamd_text:byte(pos[, pos2])</code>",id:"m8574e",level:3},{value:"Method <code>rspamd_text:len()</code>",id:"m4bc03",level:3},{value:"Method <code>rspamd_text:len_utf8()</code>",id:"m61e42",level:3},{value:"Method <code>rspamd_text:str()</code>",id:"m3916d",level:3},{value:"Method <code>rspamd_text:ptr()</code>",id:"m29f5d",level:3},{value:"Method <code>rspamd_text:save_in_file(fname[, mode])</code>",id:"m0d82f",level:3},{value:"Method <code>rspamd_text:span(start[, len])</code>",id:"m750c5",level:3},{value:"Method <code>rspamd_text:sub(start[, len])</code>",id:"m1727f",level:3},{value:"Method <code>rspamd_text:sub_utf8(start[, len])</code>",id:"mc3467",level:3},{value:"Method <code>rspamd_text:lines([stringify])</code>",id:"m49ffe",level:3},{value:"Method <code>rspamd_text:split(regexp, [stringify])</code>",id:"mfaebc",level:3},{value:"Method <code>rspamd_text:at(pos)</code>",id:"m46d6b",level:3},{value:"Method <code>rspamd_text:memchr(chr, [reverse])</code>",id:"md9089",level:3},{value:"Method <code>rspamd_text:bytes()</code>",id:"m1bc6e",level:3},{value:"Method <code>rspamd_text:lower([is_utf, [inplace]])</code>",id:"m3439c",level:3},{value:"Method <code>rspamd_text:exclude_chars(set_to_exclude, [always_copy])</code>",id:"mf4f95",level:3},{value:"Method <code>rspamd_text:memcspn(reject_chars)</code>",id:"m462a3",level:3},{value:"Method <code>rspamd_text:oneline([always_copy])</code>",id:"mfc026",level:3},{value:"Method <code>rspamd_text:normalize_newlines([mode, [pool]])</code>",id:"m223b6",level:3},{value:"Method <code>rspamd_text:base32([b32type])</code>",id:"m3dcce",level:3},{value:"Method <code>rspamd_text:base64([line_length, [nline, [fold]]])</code>",id:"mecb46",level:3},{value:"Method <code>rspamd_text:hex()</code>",id:"m1fed7",level:3},{value:"Method <code>rspamd_text:crc32([start[, len]])</code>",id:"m2494f",level:3},{value:"Method <code>rspamd_text:find(pattern [, init])</code>",id:"m32c9f",level:3}];function o(e){const n={a:"a",code:"code",h2:"h2",h3:"h3",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(n.h2,{id:"mda0fc",children:["Module ",(0,d.jsx)(n.code,{children:"rspamd_text"})]}),"\n",(0,d.jsx)(n.p,{children:"This module provides access to opaque text structures used widely to prevent\ncopying between Lua and C for various concerns: performance, security etc..."}),"\n",(0,d.jsx)(n.p,{children:"You can convert rspamd_text into string but it will copy data."}),"\n",(0,d.jsx)(n.h3,{id:"brief-content",children:"Brief content:"}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.strong,{children:"Functions"}),":"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Function"}),(0,d.jsx)(n.th,{children:"Description"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#f9e388",children:(0,d.jsx)(n.code,{children:"rspamd_text.fromstring(str)"})})}),(0,d.jsx)(n.td,{children:"Creates rspamd_text from Lua string (copied to the text)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#fe3c3c",children:(0,d.jsx)(n.code,{children:"rspamd_text.null()"})})}),(0,d.jsx)(n.td,{children:"Creates rspamd_text with NULL pointer for testing purposes."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#fa6e4a",children:(0,d.jsx)(n.code,{children:"rspamd_text.randombytes(nbytes)"})})}),(0,d.jsx)(n.td,{children:"Creates rspamd_text with random bytes inside (raw bytes)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#f01366",children:(0,d.jsx)(n.code,{children:"rspamd_text.fromtable(tbl[, delim])"})})}),(0,d.jsxs)(n.td,{children:["Same as ",(0,d.jsx)(n.code,{children:"table.concat"})," but generates rspamd_text instead of the Lua string."]})]})]})]}),"\n",(0,d.jsxs)(n.p,{children:[(0,d.jsx)(n.strong,{children:"Methods"}),":"]}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,d.jsxs)(n.table,{children:[(0,d.jsx)(n.thead,{children:(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.th,{children:"Method"}),(0,d.jsx)(n.th,{children:"Description"})]})}),(0,d.jsxs)(n.tbody,{children:[(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m8574e",children:(0,d.jsx)(n.code,{children:"rspamd_text:byte(pos[, pos2])"})})}),(0,d.jsxs)(n.td,{children:["Returns a byte at the position ",(0,d.jsx)(n.code,{children:"pos"})," or bytes from ",(0,d.jsx)(n.code,{children:"pos"})," to ",(0,d.jsx)(n.code,{children:"pos2"})," if specified."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m4bc03",children:(0,d.jsx)(n.code,{children:"rspamd_text:len()"})})}),(0,d.jsx)(n.td,{children:"Returns length of a string."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m61e42",children:(0,d.jsx)(n.code,{children:"rspamd_text:len_utf8()"})})}),(0,d.jsx)(n.td,{children:"Returns length of a string."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m3916d",children:(0,d.jsx)(n.code,{children:"rspamd_text:str()"})})}),(0,d.jsx)(n.td,{children:"Converts text to string by copying its content."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m29f5d",children:(0,d.jsx)(n.code,{children:"rspamd_text:ptr()"})})}),(0,d.jsx)(n.td,{children:"Converts text to lightuserdata."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m0d82f",children:(0,d.jsx)(n.code,{children:"rspamd_text:save_in_file(fname[, mode])"})})}),(0,d.jsx)(n.td,{children:"Saves text in file."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m750c5",children:(0,d.jsx)(n.code,{children:"rspamd_text:span(start[, len])"})})}),(0,d.jsx)(n.td,{children:"Returns a span for lua_text starting at pos [start] (1 indexed) and with."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m
11727f",children:(0,d.jsx)(n.code,{children:"rspamd_text:sub(start[, len])"})})}),(0,d.jsx)(n.td,{children:"Returns a substring for lua_text similar to string.sub from Lua."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#mc3467",children:(0,d.jsx)(n.code,{children:"rspamd_text:sub_utf8(start[, len])"})})}),(0,d.jsx)(n.td,{children:"Returns a substring for lua_text similar to string.sub from Lua using UTF8 points."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m49ffe",children:(0,d.jsx)(n.code,{children:"rspamd_text:lines([stringify])"})})}),(0,d.jsxs)(n.td,{children:["Returns an iter over all lines as rspamd_text objects or as strings if ",(0,d.jsx)(n.code,{children:"stringify"})," is true."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#mfaebc",children:(0,d.jsx)(n.code,{children:"rspamd_text:split(regexp, [stringify])"})})}),(0,d.jsxs)(n.td,{children:["Returns an iter over all encounters of the specific regexp as rspamd_text objects or as strings if ",(0,d.jsx)(n.code,{children:"stringify"})," is true."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m46d6b",children:(0,d.jsx)(n.code,{children:"rspamd_text:at(pos)"})})}),(0,d.jsxs)(n.td,{children:["Returns a byte at the position ",(0,d.jsx)(n.code,{children:"pos"}),"."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#md9089",children:(0,d.jsx)(n.code,{children:"rspamd_text:memchr(chr, [reverse])"})})}),(0,d.jsxs)(n.td,{children:["Returns the first or the last position of the character ",(0,d.jsx)(n.code,{children:"chr"})," in the text or."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m1bc6e",children:(0,d.jsx)(n.code,{children:"rspamd_text:bytes()"})})}),(0,d.jsx)(n.td,{children:"Converts text to an array of bytes."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m3439c",children:(0,d.jsx)(n.code,{children:"rspamd_text:lower([is_utf, [inplace]])"})})}),(0,d.jsx)(n.td,{children:"Return a new text with lowercased characters, if is_utf is true then Rspamd applies utf8 lowercase."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#mf4f95",children:(0,d.jsx)(n.code,{children:"rspamd_text:exclude_chars(set_to_exclude, [always_copy])"})})}),(0,d.jsx)(n.td,{children:"Returns a text (if owned, then the original text is modified, if not, then it is copied and owned)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m462a3",children:(0,d.jsx)(n.code,{children:"rspamd_text:memcspn(reject_chars)"})})}),(0,d.jsx)(n.td,{children:"Returns the length of the initial segment of text that consists entirely."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#mfc026",children:(0,d.jsx)(n.code,{children:"rspamd_text:oneline([always_copy])"})})}),(0,d.jsx)(n.td,{children:"Returns a text (if owned, then the original text is modified, if not, then it is copied and owned)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m223b6",children:(0,d.jsx)(n.code,{children:"rspamd_text:normalize_newlines([mode, [pool]])"})})}),(0,d.jsx)(n.td,{children:"Normalizes line endings in text to the specified format."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m3dcce",children:(0,d.jsx)(n.code,{children:"rspamd_text:base32([b32type])"})})}),(0,d.jsx)(n.td,{children:"Returns a text encoded in base32 (new rspamd_text is allocated)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#mecb46",children:(0,d.jsx)(n.code,{children:"rspamd_text:base64([line_length, [nline, [fold]]])"})})}),(0,d.jsx)(n.td,{children:"Returns a text encoded in base64 (new rspamd_text is allocated)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m1fed7",children:(0,d.jsx)(n.code,{children:"rspamd_text:hex()"})})}),(0,d.jsx)(n.td,{children:"Returns a text encoded in hex (new rspamd_text is allocated)."})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m2494f",children:(0,d.jsx)(n.code,{children:"rspamd_text:crc32([start[, len]])"})})}),(0,d.jsxs)(n.td,{children:["Returns the CRC-32 checksum of the byte range starting at ",(0,d.jsx)(n.code,{children:"start"}),"."]})]}),(0,d.jsxs)(n.tr,{children:[(0,d.jsx)(n.td,{children:(0,d.jsx)(n.a,{href:"#m32c9f",children:(0,d.jsx)(n.code,{children:"rspamd_text:find(pattern [, init])"})})}),(0,d.jsx)(n.td,{children:"Looks for the first match of pattern in the string s."})]})]})]}),"\n",(0,d.jsx)(n.h2,{id:"functions",children:"Functions"}),"\n",(0,d.jsxs)(n.p,{children:["The module ",(0,d.jsx)(n.code,{children:"rspamd_text"})," defines the following functions."]}),"\n",(0,d.jsxs)(n.h3,{id:"f9e388",children:["Function ",(0,d.jsx)(n.code,{children:"rspamd_text.fromstring(str)"})]}),"\n",(0,d.jsx)(n.p,{children:"Creates rspamd_text from Lua string (copied to the text)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"str {string}"}),": string to use"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": resulting text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"fe3c3c",children:["Function ",(0,d.jsx)(n.code,{children:"rspamd_text.null()"})]}),"\n",(0,d.jsx)(n.p,{children:"Creates rspamd_text with NULL pointer for testing purposes"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"str {string}"}),": string to use"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": resulting text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"fa6e4a",children:["Function ",(0,d.jsx)(n.code,{children:"rspamd_text.randombytes(nbytes)"})]}),"\n",(0,d.jsx)(n.p,{children:"Creates rspamd_text with random bytes inside (raw bytes)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"nbytes {number}"}),": number of random bytes generated"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": random bytes text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"f01366",children:["Function ",(0,d.jsx)(n.code,{children:"rspamd_text.fromtable(tbl[, delim])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Same as ",(0,d.jsx)(n.code,{children:"table.concat"})," but generates rspamd_text instead of the Lua string"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"tbl {table}"}),": table to use"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"delim {string}"}),": optional delimiter"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": resulting text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsx)(n.h2,{id:"methods",children:"Methods"}),"\n",(0,d.jsxs)(n.p,{children:["The module ",(0,d.jsx)(n.code,{children:"rspamd_text"})," defines the following methods."]}),"\n",(0,d.jsxs)(n.h3,{id:"m8574e",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:byte(pos[, pos2])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns a byte at the position ",(0,d.jsx)(n.code,{children:"pos"})," or bytes from ",(0,d.jsx)(n.code,{children:"pos"})," to ",(0,d.jsx)(n.code,{children:"pos2"})," if specified"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"pos {integer}"}),": index"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"pos2 {integer}"}),": index"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{integer}"}),": byte at the position ",(0,d.jsx)(n.code,{children:"pos"})," or varargs of bytes"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m4bc03",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:len()"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns length of a string"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{number}"}
1),": length of string in ",(0,d.jsx)(n.strong,{children:"bytes"})]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m61e42",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:len_utf8()"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns length of a string"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{number}"}),": length of string in ",(0,d.jsx)(n.strong,{children:"bytes"})]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m3916d",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:str()"})]}),"\n",(0,d.jsx)(n.p,{children:"Converts text to string by copying its content"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{string}"}),": copy of text as Lua string"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m29f5d",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:ptr()"})]}),"\n",(0,d.jsx)(n.p,{children:"Converts text to lightuserdata"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{lightuserdata}"}),": pointer value of rspamd_text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m0d82f",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:save_in_file(fname[, mode])"})]}),"\n",(0,d.jsx)(n.p,{children:"Saves text in file"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{boolean}"}),": true if save has been completed"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m750c5",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:span(start[, len])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns a span for lua_text starting at pos [start] (1 indexed) and with\nlength ",(0,d.jsx)(n.code,{children:"len"})," (or to the end of the text)"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"start {integer}"}),": start index"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"len {integer}"}),": length of span"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new rspamd_text with span (must be careful when using with owned texts...)"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m1727f",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:sub(start[, len])"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a substring for lua_text similar to string.sub from Lua"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new rspamd_text with span (must be careful when using with owned texts...)"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"mc3467",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:sub_utf8(start[, len])"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a substring for lua_text similar to string.sub from Lua using UTF8 points"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new rspamd_text with span (must be careful when using with owned texts...)"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m49ffe",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:lines([stringify])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns an iter over all lines as rspamd_text objects or as strings if ",(0,d.jsx)(n.code,{children:"stringify"})," is true"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"stringify {boolean}"}),": stringify lines"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{iterator}"}),": iterator triplet"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"mfaebc",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:split(regexp, [stringify])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns an iter over all encounters of the specific regexp as rspamd_text objects or as strings if ",(0,d.jsx)(n.code,{children:"stringify"})," is true"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"regexp {rspamd_regexp}"}),": regexp (pcre syntax) used for splitting"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"stringify {boolean}"}),": stringify lines"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{iterator}"}),": iterator triplet"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m46d6b",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:at(pos)"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns a byte at the position ",(0,d.jsx)(n.code,{children:"pos"})]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"pos {integer}"}),": index"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{integer}"}),": byte at the position ",(0,d.jsx)(n.code,{children:"pos"})," or nil if pos out of bound"]}
1),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"md9089",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:memchr(chr, [reverse])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns the first or the last position of the character ",(0,d.jsx)(n.code,{children:"chr"})," in the text or\n-1 in case if a character has not been found. Indexes start from ",(0,d.jsx)(n.code,{children:"1"})]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"chr {string/number}"}),": character or a character code to find"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"reverse {boolean}"}),": last character if ",(0,d.jsx)(n.code,{children:"true"})]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{integer}"}),": position of the character or ",(0,d.jsx)(n.code,{children:"-1"})]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m1bc6e",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:bytes()"})]}),"\n",(0,d.jsx)(n.p,{children:"Converts text to an array of bytes"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{table|integer}"}),": bytes in the array (as unsigned char)"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m3439c",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:lower([is_utf, [inplace]])"})]}),"\n",(0,d.jsx)(n.p,{children:"Return a new text with lowercased characters, if is_utf is true then Rspamd applies utf8 lowercase"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"is_utf {boolean}"}),": apply utf8 lowercase"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"inplace {boolean}"}),": lowercase the original text"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new rspamd_text (or the original text if inplace) with lowercased letters"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"mf4f95",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:exclude_chars(set_to_exclude, [always_copy])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns a text (if owned, then the original text is modified, if not, then it is copied and owned)\nwhere all chars from ",(0,d.jsx)(n.code,{children:"set_to_exclude"})," are removed\nPatterns supported:"]}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"%s - all space characters"}),"\n",(0,d.jsx)(n.li,{children:"%n - all newline characters"}),"\n",(0,d.jsx)(n.li,{children:"%c - all control characters (it includes 8bit characters and spaces)"}),"\n",(0,d.jsx)(n.li,{children:"%8 - all 8 bit characters"}),"\n",(0,d.jsx)(n.li,{children:"%% - just a percent character"}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"set_to_exclude {string}"}),": characters to exclude"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"always_copy {boolean}"}),": always copy the source text"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": modified or copied text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m462a3",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:memcspn(reject_chars)"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns the length of the initial segment of text that consists entirely\nof characters NOT in reject_chars (like C's strcspn, but for binary data)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"reject_chars {string}"}),": set of characters to reject"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{integer}"}),": length of the initial segment"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"mfc026",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:oneline([always_copy])"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a text (if owned, then the original text is modified, if not, then it is copied and owned)\nwhere the following transformations are made:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"All space
1s sequences are replaced with a single space"}),"\n",(0,d.jsx)(n.li,{children:"All newlines sequences are replaced with a single space"}),"\n",(0,d.jsx)(n.li,{children:"Trailing and leading spaces are removed"}),"\n",(0,d.jsx)(n.li,{children:"Control characters are excluded"}),"\n",(0,d.jsx)(n.li,{children:"UTF8 sequences are normalised"}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"always_copy {boolean}"}),": always copy the source text"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": modified or copied text"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m223b6",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:normalize_newlines([mode, [pool]])"})]}),"\n",(0,d.jsx)(n.p,{children:"Normalizes line endings in text to the specified format."}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:'If mode is "lf" or "unix": converts CRLF to LF'}),"\n",(0,d.jsx)(n.li,{children:'If mode is "crlf" or "windows" (default): converts bare LF to CRLF'}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:"If the text is owned, it may be modified in-place.\nIf a mempool is provided, new memory is allocated from it.\nOtherwise, g_malloc is used and OWN flag is set."}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"mode {string}"}),': target newline mode: "lf" or "crlf" (default: "crlf")']}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"pool {mempool}"}),": optional mempool for allocation"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": normalized text (may be same as input if no changes)"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m3dcce",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:base32([b32type])"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a text encoded in base32 (new rspamd_text is allocated)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"b32type {string}"}),": base32 type (default, bleach, rfc)"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new text encoded in base32"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"mecb46",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:base64([line_length, [nline, [fold]]])"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a text encoded in base64 (new rspamd_text is allocated)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"line_length {number}"}),": return text split with newlines up to this attribute"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"nline {string}"}),": newline type: ",(0,d.jsx)(n.code,{children:"cr"}),", ",(0,d.jsx)(n.code,{children:"lf"}),", ",(0,d.jsx)(n.code,{children:"crlf"})]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"fold {boolean}"}),": use folding when splitting into lines (false by default)"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new text encoded in base64"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m1fed7",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:hex()"})]}),"\n",(0,d.jsx)(n.p,{children:"Returns a text encoded in hex (new rspamd_text is allocated)"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsx)(n.p,{children:"No parameters"}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{rspamd_text}"}),": new text encoded in hex"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m2494f",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:crc32([start[, len]])"})]}),"\n",(0,d.jsxs)(n.p,{children:["Returns the CRC-32 checksum of the byte range starting at ",(0,d.jsx)(n.code,{children:"start"}),"\n(1-indexed, default 1) and spanning ",(0,d.jsx)(n.code,{children:"len"})," bytes (default: to the end of the\ntext). The range is read in place (no copy). This is the standard CRC-32\n(zlib crc32 / YARA hash.crc32, polynomial 0xEDB88320) and the result is a Lua\ninteger suitable for numeric comparison (e.g. ",(0,d.jsx)(n.code,{children:"t:crc32() == 0xCBF43926"}),")."]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"start {integer}"}),": 1-based start index"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"len {integer}"}),": number of bytes"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{integer}"}),": crc32 value as an unsigned 32-bit integer"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.h3,{id:"m32c9f",children:["Method ",(0,d.jsx)(n.code,{children:"rspamd_text:find(pattern [, init])"})]}),"\n",(0,d.jsx)(n.p,{children:"Looks for the first match of pattern in the string s.\nIf it finds a match, then find returns the indices of s where this occurrence\nstarts and ends; otherwise, it returns nil. A third,\noptional numerical argument init specifies where to start the search;\nits default value is 1 and can be negative.\nThis method currently supports merely a plain search, no patterns."}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Parameters:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"pattern {string}"}),": pattern to find"]}),"\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"init {number}"}),": specifies where to start the search (1 default)"]}),"\n"]}),"\n",(0,d.jsx)(n.p,{children:(0,d.jsx)(n.strong,{children:"Returns:"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:[(0,d.jsx)(n.code,{children:"{number,number/nil}"}),": If it finds a match, then find returns the indices of s where this occurrence starts and ends; otherwise, it returns nil"]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#mda0fc",children:"module description"}),"."]}),"\n",(0,d.jsxs)(n.p,{children:["Back to ",(0,d.jsx)(n.a,{href:"#",children:"top"}),"."]})]})}function x(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(o,{...e})}):o(e)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.