Go Back   vb.org Archive > Community Central > vBulletin.org Site Feedback
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 11-14-2005, 09:34 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brad
At first yes, but once you get the hang of them they become very powerful.
Yes, I can understand that but they are still difficult
And my book only talks about the other ones (those that work with ereg_replace )
Reply With Quote
  #12  
Old 11-14-2005, 09:49 AM
Brad Brad is offline
 
Join Date: Nov 2001
Posts: 4,765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Shame, I notice a lot of them leave out PCRE.

http://www.tote-taste.de/X-Project/regex/

Hopefully you'll find that link of use.
Reply With Quote
  #13  
Old 11-14-2005, 09:51 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Brad
Shame, I notice a lot of them leave out PCRE.

http://www.tote-taste.de/X-Project/regex/

Hopefully you'll find that link of use.
Thanks, I bookmarked
It looks nice-written
Reply With Quote
  #14  
Old 11-14-2005, 09:59 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well by answer was the best for the original question, only to remove the spaces. If you have the choice, a str_replace is much faster. Dean however extended to original question nicely with the removal of some more special characters (although with some limitations that could also be done with str_trplace..
Reply With Quote
  #15  
Old 11-14-2005, 10:02 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarcoH64
Well by answer was the best for the original question, only to remove the spaces. If you have the choice, a str_replace is much faster. Dean however extended to original question nicely with the removal of some more special characters (although with some limitations that could also be done with str_trplace..
Yep, why shouldn't that for example be doen with str_replace (many of them for the other characters)? Is it slower?
Reply With Quote
  #16  
Old 11-14-2005, 10:06 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BEcause with a str_replace you can only search for a list of chracters. With regular expressions, you can also deny any character that is not in a list.
Reply With Quote
  #17  
Old 11-22-2005, 02:18 AM
David Copeland's Avatar
David Copeland David Copeland is offline
 
Join Date: Oct 2001
Location: USA
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dean C
Or better yet

PHP Code:
$name preg_replace('/[^A-Za-z0-9-_`\[\]]/i'''$name); 

Dean C,

I noticed you are the only one in this thread with a space between first and last name, such as my user name.

So do I have to log out as David Copeland to use this forum's chat?? Or can the webmaster here modify the code to allow anyone with a space to use the live chat?

David
Reply With Quote
  #18  
Old 11-22-2005, 02:22 AM
Guest190829
Guest
 
Posts: n/a
Default

No, once you go into the chat and get the error just type:

Quote:
/nick NICKNAME
Replace NICKNAME with any other nickname that you want, and that doesn't produce an error. My username isn't allowed either thanks to the period, but I use Danny on the irc.
Reply With Quote
  #19  
Old 11-22-2005, 02:46 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mine also isn't allowed because of the space - I use ChrisM with no space

Chris
Reply With Quote
  #20  
Old 11-22-2005, 02:55 AM
Jenta Jenta is offline
 
Join Date: Dec 2004
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
// bad characters
$cleanchr preg_replace("/[^ \\\\{}\^`\[\]\|\-\w]/"""$vbulletin->userinfo['username']);

// leading numbers and dashes
$cleannum ereg_replace("^[0-9\-]*[0-9\-]"""$cleanchr);

// convert spaces to underscores
$nick ereg_replace(" ""_"$cleannum); 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:25 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10156 seconds
  • Memory Usage 2,258KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete