PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Nov 21, 2019 8:18 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Mon May 23, 2005 8:59 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
\w is for "word" characters. alphanumeric plus _, if I'm not mistaken. Change the \w to .


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 23, 2005 9:07 pm 
Offline
Forum Contributor
User avatar

Joined: Tue Aug 10, 2004 3:08 am
Posts: 424
Thanks for your reply. Changing the /w to a dot (.) stops it from working alltogether... Any ideas why?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 1:33 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
... it shouldn't. post the code. :/


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 4:57 pm 
Offline
Forum Contributor
User avatar

Joined: Tue Aug 10, 2004 3:08 am
Posts: 424
I tried replacing both with dots, only one with dots...

Syntax: [ Download ] [ Hide ]
$xhtml =preg_replace('/(.+)=(.+)/is','\\1="\\2"',$xhtml);


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 9:10 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
Well that doesn't make any damn sense. . includes \w... *thinks*
Maybe it's catching the ws. Try using '\S' (capital S).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 9:29 pm 
Offline
Forum Contributor
User avatar

Joined: Tue Aug 10, 2004 3:08 am
Posts: 424


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 10:03 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
haha, well, your two code examples were the same. But here's what you need. Instead of "\w" or "." use "[\w:\/-_]" (the / is escaped)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 24, 2005 10:14 pm 
Offline
Forum Contributor
User avatar

Joined: Tue Aug 10, 2004 3:08 am
Posts: 424


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 12:17 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
haha, didn't even see the difference in the ".

Anyway, this: [\w:\/-_.] was supposed to be: [\w:\/-_] (no .)

If that doesn't work, you could try to look for things to not include:
[^>\'\"\s]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 4:53 pm 
Offline
Forum Contributor
User avatar

Joined: Tue Aug 10, 2004 3:08 am
Posts: 424
That's perfect :) Seems to work fine. Thank you for all your help. I could never have done it without you.

The reason I used [\w:\/-_.] was because it was adding the quote after the first dot (E.g: <a href="http://www."google.com>)... But that doesn't matetr anymore. It works :)

Thanks again!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 5:02 pm 
Offline
Forum Regular
User avatar

Joined: Sat Mar 12, 2005 8:13 pm
Posts: 703
Location: US
Cool. ^_^
Yeah, if looking for an actual dot, then you need to escape it (\.). A single . is a regex special char which means 'any character.' ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group