Module talk:String/doc

From mediawiki.org

Pipe character handling and identifying[edit]

How do I match a pipe character? How would one find, replace, position, find the length of, or repeat a string with a pipe character in it?

{{#invoke:String|match|[[page name and |its markup]]|[%a ]+.[%a ]+|nomatch = nope}} --> page name and |its markup

So apparently

  • dot can match the pipe character, but that's too vague.
  • %a cannot match the pipe character, but can match square brackets.
  • a pipe can be in the source string, but only if it's between double square brackets. (Len proves that.)

I need to extract a pagename and its markup from a wikilink.

Thanks,

Cpiral (talk) 16:36, 19 May 2015 (UTC)Reply