House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  Regular Expressions (RegEx)

regex for twitter style URL

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Hi
Andy Jarrett
07/04/09 10:10 P
Try this:
Peter Boughton
07/04/09 10:35 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Andy Jarrett
07/04/2009 10:10 PM

Hi I am trying to do a mod_rewrite for twitter style username urls to http://myurl.com/andyjarrett would go to http://myurl.com/index.cfm?user=andyjarrett So far I have RewriteRule ^(((?!user|index.cfm))*.?)*$ index.cfm?user=$1 [L,QSA] But this just isnt working. Anyone done this or can help? Thanks, Andy Jarrett www.andyjarrett.co.uk

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Peter Boughton
07/04/2009 10:35 PM

Try this: ^(?!user|index\.cfm)([\w-]+)$ Note that this allows only usernames containing alphanumeric, underscore, and/or hyphen. If usernames allow more characters, or you want to defer validation to the script, you could use something more inclusive (e.g ".+") instead of "[\w-]+", for that part of the expression. Oh and not too sure what the "user" part there is for, but it may need updating if you don't want to block names such as "useredpaint" and similar.


<< Previous Thread Today's Threads Next Thread >>

Search regex

May 25, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference