[Gambas-user] Regular expressions
T Lee Davidson
t.lee.davidson at gmail.com
Thu Dec 30 18:38:01 CET 2021
On 12/30/21 07:37, Hans Lehmann wrote:
> Hello.
>
> I am looking for 3 regular pattern expressions that check in a DokuWiki text whether the formats `underlined`, `italic` or
> `bold` are in the given text.
>
> Example text:
>
> The //installation// of a **SSH server** on the remote __computer__ is worthwhile in any case!
>
> My many attempts ended up with these patterns, which unfortunately do not work:
>
> IF sLine Like "*[_]{2}*[_]{2}*" THEN sLine = Replace(sLine, "__", "<uuu>")
> IF sLine Like "*[*]{2}*[*]{2}*" THEN sLine = Replace(sLine, "**", "<bbb>")
> IF sLine Like "*[/]{2}*[/]{2}*" THEN sLine = Replace(sLine, "//", "<iii>")
>
> Any hint in the right direction will be gladly read.
>
> With kind regards
>
> Hans
DokuWiki stores all its data in UTF-8.[1] This is almost certainly the reason it is not working since LIKE deals only with ASCII
strings.[2]
You should use RegExp.Replace (gb.pcre) [3] as LIKE is not a valid solution for this particular scenario.
--
Lee
[1] https://www.dokuwiki.org/utf-8
[2] http://gambaswiki.org/wiki/lang/like
[3] http://gambaswiki.org/edit/comp/gb.pcre/regexp/replace
More information about the User
mailing list