Advertisement
jargon

bbcode regex (pattern and replace)

Dec 20th, 2016
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REG 1.07 KB | None | 0 0
  1. /\[color\=\"([A-Za-z]+)\"]([^[]+?[^]])\[\/color\]/
  2. /\[color\=\"(\#[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])\"]([^[]+?[^]])\[\/color\]/
  3. /\[color\=\"(\#[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])\"]([^[]+?[^]])\[\/color\]/
  4. /\[sub\](([^[][^\/]{0,1}[^s][^u][^b][^]])+)\[\/sub\]/
  5. /\[sup\](([^[][^\/]{0,1}[^s][^u][^p][^]])+)\[\/sup\]/
  6. /\[b\](([^[][^b][^]]|[^[][^/][^b][^]])+)\[\/b\]/
  7. /\[i\](([^[][^i][^]]|[^[][^/][^i][^]])+)\[\/i\]/
  8. /\[u\](([^[][^u][^]]|[^[][^/][^u][^]])+)\[\/u\]/
  9. /\[s\](([^[][^s][^]]|[^[][^/][^s][^]])+)\[\/s\]/
  10. /\[tt\](([^[][^t][^t][^]]|[^[][^/][^t][^t][^]])+|.)\[\/tt\]/
  11. /\[url\=\"(([^[][^u][^=\]]|[^[][^u][^r][^l][^=\]]|[^[][^/][^u][^]]]|[^[][^/][^u][^r][^l][^=]])+)\[\/url\]/
  12. /\[u\=\"(([^"]+)\"]([^[][^u][^=\]]|[^[][^u][^r][^l][^=\]]|[^[][^/][^u][^]]]|[^[][^/][^u][^r][^l][^=]])+)\[\/u\]/
  13. ===
  14. <font color="$1">$2</font>
  15. <font color="$1">$2</font>
  16. <font color="$1">$2</font>
  17. <sub>$1</sub>
  18. <sup>$1</sup>
  19. <b>$1</b>
  20. <i>$1</i>
  21. <u>$1</u>
  22. <strike>$1</strike>
  23. <tt>$1</tt>
  24. <a href="$1" target="_blank">$2</a>
  25. <a href="$1" target="_blank">$2</a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement