|
|
|
|
![]() ![]() |
Apr 15 2005, 01:05 PM
Post
#11
|
|
|
Premium Member Group: Members Posts: 208 Joined: 6-September 04 From: England Member No.: 315 |
lol yes i did Viz
|
|
|
|
May 2 2005, 08:02 AM
Post
#12
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 4 Joined: 2-May 05 From: Alpha Centauri Member No.: 4,636 |
First of all, if you are just trying to escape HTML characters use:
-htmlentities() OR -htmlspecialchars() which are built-in PHP functions. If you are just trying to learn regexp, more power to you! In PCRE regular expressions, there are several types of delimiters you can use for your patterns CODE <?php # This finds all tags $pattern = "@<\w+?[^>]>@is"; // @ is the delimiter in pattern. ?> That was a very eloquent pattern, mastercomputers. I just recently started using look aheads/behinds, and have had fun toying around with them Also, if you want to print out mastercomputers' result with preg_match, try the following for some good practice: CODE <?php $file = "path/to/file"; $handle = @file_get_contents($file) or die("File not acquired!\n</body>\n</html>"); // This is safer! $pattern = "#Latest\sMember:\s.+?(?=\s)#i"; if ( preg_match($pattern, $handle, $matches) ) { print "<pre>\n".print_r($matches)."\n<pre>\n"; } else { print "<p>Nothing found =("; } # Finds all matches if ( preg_match_all($pattern, $handle, $matches) ) { # $matches is now a 2-dimensional array print "<pre>\n".print_r($matches)."\n</pre>\n"; } else { print "Nothing found =("; } ?> Peace, +CurTis- |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 1st December 2008 - 05:06 PM |