Assuming you talk about /[\w\W]/i the answer is (AFAIK) everything is matched (I've tested french char with accent, spaces, newlines...) except empty string of course...
Otherwise /\w\W/i doesn't match a lot of things... | [reply] [d/l] |
Yep, that was what I was talking about, but it was very early in the morning when the question came up :o)
| [reply] |
There are quite many strings that doesn't match your pattern: Everything that contains only of
- word characters
- non-word characters
- non-word characters followed by word-characters
- the empty string
If you meant what arhuman thought (/[\w\W]/i) he has forgot that it wouldn't match the empty string, even then. | [reply] [d/l] |
yes. \w matches any "word" character = [a-zA-Z_0-9]. \W matches anything else. the /i makes no difference in this example (it does not make the regex /[\w\W][\W\w]/ as I think you may believe).
The following will not match:
- empty strings
- single character strings
- any 2 character string with a \W char followed by a \w char (e.g. '*f', '£L', '+3' etc.)
- any string > 2 chars comprised solely of \w or \W chars (e.g. 'abcdef', '%^£$' etc.)
Can't think of any more!
Hope this helps - larryk
"Argument is futile - you will be ignorralated!" | [reply] [d/l] [select] |
| [reply] |
$_="x";
print "Matched" if /\w\W/i;
will not print Matched. It's easy to have a string that contains no non-word characters. | [reply] [d/l] |