Skip to content

Instantly share code, notes, and snippets.

@chssweb
Last active August 29, 2015 14:02
Show Gist options
  • Save chssweb/4bc61c9a8ce811314727 to your computer and use it in GitHub Desktop.
Save chssweb/4bc61c9a8ce811314727 to your computer and use it in GitHub Desktop.
Regex test to try and get url out of description
    <Node id="{CDA3925C-FAC0-43BC-8ED4-C69680EBF094}" Display="What's New in Version 4 Video(Double click the icon) http://www.ned.cc.uk" Order="0" FontFamily="Calibri" FontSize="14" FontBold="false" FontItalic="false" FontStrikeOut="false" BorderStyle="Solid" BorderWidth="2" FontColor="FF000000" Marker="00FFFFFF" HLinkText=""/>

##Search Pattern

    ^(.*)((http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?)(.*)(/>)$

##Replace Pattern

    $1 $3 href="$2" />
@chssweb
Copy link
Author

chssweb commented Jun 10, 2014

Search
(.)((http|https|ftp)://[-A-Za-z0-9+&@#/%?=~_()|!:,.;][-A-Za-z0-9+&@#/%=~_()|])(.*)/>

Replace
$1 $4 href="$2" />

@chssweb
Copy link
Author

chssweb commented Jun 10, 2014

    /^(.*)(Display=".*)(http:\/\/[-A-Za-z0-9+&@#/%?=~()|!:,.;]*[-A-Za-z0-9+&@#/%=~()|])(.*")(.*\/>)$/mig


    $1 $2$4 href="$3" $5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment