Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 30th, 2007, 12:13 PM   #1
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
PHP Regular Expression: Matching All Possible Characters

Using regular expressions in php is there a special character or a simple way of writing an regular expression which can match any possible characters in a string, without having to write all the possible combinations of the string, for example if you wanted to match a string which can contain all the possible characters.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old May 30th, 2007, 3:27 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Your question is nonsensical. What is the definition of "all possible characters"? In the extreme, it is every possible value that can be generated by a particular number of bits. This means that ANYTHING matches.

Restricting the set is purely a language/cultural issue.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 30th, 2007, 4:04 PM   #3
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
sorry i'm terrible at explaining myself

string1 = sitename
string2 = message

And if i was given the two strings concatenated:
sitenameauthor

Now the sitename and message can contain any printable character, how would i go about seperating these two strings.

to obtain the site name I thought of doing:
/http:\/\/ww\.[Aa-Zz0\-9 and then all the other printable characters]*/
i think that's properly one way, is there another way.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old May 30th, 2007, 6:22 PM   #4
Styx
Programmer
 
Join Date: Mar 2007
Posts: 39
Rep Power: 0 Styx is on a distinguished road
Well, a site name can't have just any printable character. There are specifications.

It would be easier to put a separator of some kind so you can just explode it or split it or something. But if you want to keep it like that, you can check based on tlds.

Also, with regular expressions, any character is represented by a dot: .
^.*$ matches anything
Styx is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Regular Expression King C# 2 Apr 30th, 2006 9:41 PM
Word Frequency Regular Expression hoffmandirt C# 4 Feb 27th, 2006 8:21 PM
Break Point Problem on VC++ 6.0 chanwing C++ 4 Feb 8th, 2006 3:42 AM
Regular Expression toghian C++ 12 Dec 28th, 2005 10:12 PM
Regular Expression HELP -- thanks paulchwd JavaScript and Client-Side Browser Scripting 3 Oct 11th, 2005 4:40 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC