mickabouille Posted February 26, 2022 Posted February 26, 2022 For some reason, I find the strings and regex support in weidu very unwieldy. Actually, the whole value/variable notion seems somewhat fuzzy. Most of the things I will state below are what I gathered in a very limited, short and incomplete attempt at learning to use it. It's _suspicions_ not certitudes, and an attempt to obtain confirmation or counter-examples (or maybe "don't do that"). Weidu strings are byte arrays, meaning there is no encoding/decoding done from files, they are in memory as they are on files. As a consequence, you can't compare or match strings coming from files with different source encodings, except when using ASCII, that is, the characters with codes 0-127, in a ASCII compatible charset (mostly, utf8 and latin charsets ISO-8859-XX) another probable consequence: STRING_LENGTH doesn't return the character count but the byte count (?) which is different when the text comes from utf8 weidu (probably?) doesn't do normalization of unicode "strings" (I suppose utf8 is the only unicode encoding that is used, but I have not checked that) you probably can't compare/match two strings either (for example comapre the precomposed character é with e with diacritic acute accent) STRING_COMPARE_CASE, FILE_CONTAINS probably don't ignore case for characters not in ASCII 0-127 Those are probably more "I didn't find how": How do you do non-capturing groups in regexes ? How do you check is a string contains another one (STRING_CONTAINS_REGEXP doesn't, the second parameter is interpreted as a regex, not a string, so for example dots need to be escaped) Quote
lynx Posted February 26, 2022 Posted February 26, 2022 1. You can't by default, you'd have to use an external program that does support pcre-like regexes. It's more of a limit of the ocaml stdlib than anything else. 2. You suggested a workaround yourself — you can have an escaping function mangle the string first. Quote
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.