RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 4
Title Test Details Match MediaWiki Internal and External Links
Expression
(?<=\r\n)\[.*\]
Description
This will match both internal and external links from mediawiki content. IT should also work for all wiki types that use both single and double square brackets "[ and ]". it will NOT MATCH a link surrounded by a header. Square brackets are tricky because they are used in Regular Expressions and must use the metacharacter to match them
Matches
[[Example Internal Wiki Link Double Square Brackets]] | [https://regexlib.com Example External Wiki Link] | [[Another Internal Link]]
Non-Matches
=== HEADING 3 === | A Simple String of Text not surrounded by anything | ===[[Will Not Match a link surrounded by a header]]===
Author Rating: Not yet rated. Matthew Reinsmith
Title Test Details Extract URI Match from MediaWiki External Links and seperate from title
Expression
(?<=\r\n)\[.*\]
Description
This will match the URI in an internal wiki link separately from its title in mediawiki content.
Matches
[https://sub.domain.com/wiki/index.php?title=test Sample Wiki Link] | [https://regexlib.com/page.aspx Example External Wiki Link] | [https://servername/subfolder/sample.txt Sample Web Document Link]
Non-Matches
[file://\\servername\subfolder\sample.txt Sample Text Link] | [[An External Link] | ===[https://sub.domain.com/wiki/index.php Will Not Match a link surrounded by a header]===
Author Rating: Not yet rated. Matthew Reinsmith
Title Test Details Match External Wiki Link ONLY
Expression
(?<!\[)\[(?!\[).*(?<!\])\](?!\])
Description
This will match the an External wiki link ONLY allowing you to separate the href and the title for use in other link types
Matches
[https://sub.domain.com/wiki/index.php?title=test Sample Wiki Link] | [https://regexlib.com/page.aspx Example External Wiki Link] | ===[https://sub.domain.com/wiki/index.php Does Match a link surrounded by a header]===
Non-Matches
[[file://\\servername\subfolder\sample.txt Sample Text Link]] | [[Example Wiki Link Double Square Brackets]] | [https://sub.domain.com/wiki/index.php Will Not Match a link which is missing its matching bracket
Author Rating: Not yet rated. Matthew Reinsmith
Title Test Details Separating an HTML Hyperlink using nested named groups
Expression
<a.*?href=[""'](?<uri>(?<path>.*?)file:(?<file>.*?))[""'].*?>(?<description>.*?)</a>
Description
Uses nested named groups to break down hyperlink into several different components including filename, path, the complete uri, and the link description between the tags
Matches
<p><a href="/folderindex.php?title=File:picture.jpg" class="image"><img alt=" picture.jpg" src="/folder/images/ picture.jpg " width="100" height="50" /></a></p>
Non-Matches
<p><a href="http://site.com/folder.html” class="html"><img alt="picture.jpg" src="/folder/images/ picture.jpg " width="100" height="50" /></a></p>
Author Rating: Not yet rated. Matthew Reinsmith
   Displaying page 1 of 1 pages; Items 1 to 4

Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials