Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
TrayStatus
VoiceBot
WallpaperFusion
Clipboard
Fusion
by Binary Fortress Software
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
Features
Features
HotKeys
Macros
Triggers
Clipboard Syncing
Clipboard Manager
Languages
Free vs Pro
Apps
More
Screenshots
Macros
Languages
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Purchase
Login / Register
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
HTML to UBB code
Return to ClipboardFusion Macros
Description
Converts HTML formatting to UBB (bulletin/message board) formatting.
Language
C#.net
Minimum Version
4.2+
Created By
小恐龙
Contributors
-
Date Created
Aug 1, 2017
Date Last Modified
Aug 1, 2017
Macro Code
Copy
Select All
using System; using System.Collections.Generic; using System.Text.RegularExpressions; //小恐龙 //ver 1.0 // 转换 html 代码为论坛常用的 ubb 代码. public static class ClipboardFusionHelper { public static string ProcessText(string text) { text = Regex.Replace(text, "<br[^>]*>", "\n"); text = Regex.Replace(text, @"<p[^>\/]*\/>", "\n"); text = Regex.Replace(text, "\\son[\\w]{3,16}\\s?=\\s*([\'\"]).+?\\1", ""); text = Regex.Replace(text, "<hr[^>]*>", "[hr]"); text = Regex.Replace(text, "<(\\/)?blockquote([^>]*)>", "[$1blockquote]"); text = Regex.Replace(text, "<img[^>]*smile=\"(\\d+)\"[^>]*>", "'[s:$1]"); text = Regex.Replace(text, "<img[^>]*src=[\'\"\\s]*([^\\s\'\"]+)[^>]*>", ""); text = Regex.Replace(text, "<a[^>]*href=[\'\"\\s]*([^\\s\'\"]*)[^>]*>(.+?)<\\/a>", "[url=$1]$2[/url]"); text = Regex.Replace(text, "<b>(.+?)</b>",@"\[b\]$1\[/b\]"); text = Regex.Replace(text, "<[^>]*?>", ""); text = Regex.Replace(text, "&", "&"); text = Regex.Replace(text, " ", " "); text = Regex.Replace(text, "<", "<"); text = Regex.Replace(text, ">", ">"); return text; } }