[Gambas-user] Regular expressions

Gianluigi bagonergi at gmail.com
Thu Dec 30 14:46:15 CET 2021


Il giorno gio 30 dic 2021 alle ore 14:01 Hans Lehmann <hans at gambas-buch.de>
ha scritto:

> 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
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

Hi Hans,

Perhaps this can help:

Public Sub Main()

  Dim sText As String = "The //installation// of a **SSH server** on the
remote __computer__ is worthwhile in any case!"

  Print Scan(sText, "*//*//*")[1]
  Print Scan(sText, "*__*__*")[1]
  Print Scan(sText, "*{**}*{**}*")[1] ' here i do not understand

End

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20211230/720c52be/attachment.htm>


More information about the User mailing list