Topic on Extension talk:Replace Text

Change <ref>*</ref> to ""

5
SimcaCZE (talkcontribs)

Hi, How I change "<ref>*</ref>" to ""??

Keyacom (talkcontribs)

I see you're looking for the regex that matches any text inside <ref> tags, which also includes both the opening and closing tags.

It's /<ref>[\s\S]*?<\/ref>/ (without the leading or trailing slashes):

  • \/ is intepreted as a literal /
  • [\s\S]* is intepreted as at least 0 characters, including newlines. ? makes the * quantifier lazy (so it matches as least characters as possible).
SimcaCZE (talkcontribs)

Thansk, but it is not working. <ref>*</ref> I have more in article. This sequense delete text in first <ref> and last </ref>

Keyacom (talkcontribs)

That's what the ? modifier to make the * quantifier ungreedy is for. Remove the question mark just in case, I think this uses PCRE's U flag, which makes quantifiers ungreedy by default.

SimcaCZE (talkcontribs)

Hi, I correct code. It is Ok. It is making, what I want. Thanks for help.

Reply to "Change <ref>*</ref> to """