p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 (http://p2p.wrox.com/forumdisplay.php?f=160)
-   -   Adding regular expression (email+URL) (http://p2p.wrox.com/showthread.php?t=55785)

Beebs March 23rd, 2007 04:51 PM

Adding regular expression (email+URL)
 
Chapter 16 :

Here's the forum_bbcode table :
[code

CREATE TABLE IF NOT EXISTS forum_bbcode (
id int(11) NOT NULL auto_increment,
template varchar(255) NOT NULL default '',
replacement varchar(255) NOT NULL default '',
PRIMARY KEY (id)
)ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `forum_bbcode`
--

INSERT INTO `forum_bbcode` VALUES (1,'\[b\]([^[]+?)\[\/b\]','<b>$1</b>');
INSERT INTO `forum_bbcode` VALUES (2,'\[i\]([^[]+?)\[\/i\]','<i>$1</i>');
INSERT INTO `forum_bbcode` VALUES (3,'\[u\]([^[]+?)\[\/u\]','[u]$1</u>');
INSERT INTO `forum_bbcode` VALUES (4,'\[url\]([^[]+?)\[\/url\]','<a href="$1" target="_blank">$1</a>');
INSERT INTO `forum_bbcode` VALUES (5,'\[url=([^]]+?)\]','<a href="$1" target="_blank">');
INSERT INTO `forum_bbcode` VALUES (6,'\[\/url\]','</a>');

[/code]

I need your help for :

1. How to add email regular expression ? This is my effort which give an error message :
Code:

INSERT INTO `forum_bbcode` VALUES (7,'\[email\](([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+))\[\/email\]','<a href=\"mailto:$1\">$1</a>');
2. How to change the style that was set from chapter 16 set for adding URL and email? I am talking about this style of email and URL :
Code:

<a href="mailto:myemail@mail.com">myemailtitle</a>
.

So that when user click on the email & URL icon they will be prompted to add their email/URL title and then the link.

3. I'll appreciate if you can help me to add regular expression for ordered amd unordered list


All times are GMT -4. The time now is 09:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.