Replace text and regular expressions: Difference between revisions

From CCMDB Wiki
Jump to navigation Jump to search
m (Text replacement - "Wiki Usage" to "Wiki use")
mNo edit summary
 
Line 15: Line 15:
* R: $1 (T)
* R: $1 (T)
* After text: Wrist Joint (T)  
* After text: Wrist Joint (T)  
== Example to match variations with inconsistent capitalization (and I think inconsistent spacing) ==
Two other cents, to find any and all variations. (assuming one template parameter per line)
Search: "(?i)(\n) *\| *tItEl *=.*\n"
Replace: "$1"
== Related articles ==
{{Related Articles}}




[[Category: Wiki use]]
[[Category: Wiki use]]

Latest revision as of 12:14, 2021 January 6

Confuses me every time, so hoping to leave example this time.

Special:ReplaceText allows use of regular expressions, see their documentation.

Simple Example

  • Page has abcdefghi
    • Original text: abcdef(.*)hi ie want it to match the "g"
    • Replacement text: wx$1yz ie want it to put the matched string between wx and yz
  • results in wxgyz

Example with line end anchor

Not sure why it had to be used, but without it the rest of the words didn't get matched.

  • Before text (title): (T) Wrist Joint
  • O: \(T\) (.*)$ the $ shows end of line
  • R: $1 (T)
  • After text: Wrist Joint (T)

Example to match variations with inconsistent capitalization (and I think inconsistent spacing)

Two other cents, to find any and all variations. (assuming one template parameter per line) Search: "(?i)(\n) *\| *tItEl *=.*\n" Replace: "$1"

Related articles

Related articles: