Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   PHP Regular Expression: Matching All Possible Characters (http://www.programmingforums.org/showthread.php?t=13249)

kruptof May 30th, 2007 12:13 PM

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.

DaWei May 30th, 2007 3:27 PM

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.

kruptof May 30th, 2007 4:04 PM

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.

Styx May 30th, 2007 6:22 PM

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


All times are GMT -5. The time now is 3:03 PM.

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