Tags:
create new tag
view all tags

SID-01911: Global Replace Plugin Search for TWiki Link Code

Status: Answered Answered TWiki version: Perl version: 5.10.1
Category: GlobalReplacePlugin Server OS: Turnkey Linux 12.1 Last update: 11 years ago

In trying to search for TWiki link code (such as [[) and replace it with HTML link code (such as <a href="), Global Replace does not behave as for other searches / replaces.

With the following specified: Topic Search String: ?.* (to search all topics in the web) Replace Search String: \[[ (to locate all instances of "[[" in each searched topic)

The following standout odd results occur: 1. Only the first instance of "[[" in each topic is returned; none of the other instances is returned. (For my searches, these are WebHome links.)

2. Instead of returning "[[" matches, "[[WebHome" instances are returned.

3. The returned "[[WebHome" match is actually duplicated. Which does NOT occur in the topic. The core of a typical returned topic is as below: Text Found: [[WebHome[[WebHome (Where the first is red-texted for replacement.) Replace With: <a href="[[WebHome

Does anyone know the reason for this?

Thanks,

-- Patrick Townsend-Wells - 2014-04-18

Discussion and Answer

The [ is a special character that starts a character set. You need to escape special characters if you want to scan literally. So, search for \[\[. If you want to scan for the full link, write \[\[(.*?)\]\], and in the replace part use $1 to get the topic name.

See regular expression presentation at TWikiPresentation2013x03x07

-- Peter Thoeny - 2014-04-20

Fantastic Peter.

Thanks,

The Odd One

-- Patrick Townsend-Wells - 2014-04-21

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Global Replace Plugin Search for TWiki Link Code
SupportCategory GlobalReplacePlugin
TWiki version

Server OS Turnkey Linux 12.1
Web server Apache 2
Perl version 5.10.1
Browser & version Chrome 34.0.1847.116
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2014-04-21 - PatrickTownsendWells
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.