![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
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:
|
|
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#3 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 329
Rep Power: 3
![]() |
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]*/
__________________
Quote:
|
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Mar 2007
Posts: 39
Rep Power: 0
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |