php won't recognize a carriage return

brianj7675_at_yahoo.com
Date: 03/30/05


Date: 29 Mar 2005 20:18:54 -0800

php 4.3.6
windows xp

i need to read a file and match a regular expressions with this
pattern: "\r\ntitle"

preg_match($title_reg, $line, $resB);
$find_reg="\r\n$resB[0]";
if (ereg($find_reg, $line2))
echo $resb[0];

now if i put this pattern in powergrep 2.3.2 it recognizes it. however
if i try to use this pattern in my php script i get bupkis nada nothing
zero. i've tried putting the carriage return in () and in [] but i get
nothing still. when i print the pattern to my browser i see a space in
front of my title showing me that php is recognizing something but it
does not print the \r\n so i'm pretty sure that is why i'm not getting
a match.now i know these are not printable characters but they are in a
string so they should print to the screen.
So my assumption is that php is erasing or translating /r/n into
something so that it does not match my pattern.



Relevant Pages

  • Re: Why Is The URL Affecting My Variables?
    ... >Onideus Mad Hatter contained the following: ... experienced enough with PHP. ... And why is there no discernable pattern? ... in hidden layers (so I can avoid those nasty unchangable grey drop down boxes). ...
    (comp.lang.php)
  • Useless OO php examples. - found some good ones though.
    ... even a few design patterns in my head. ... "Here's how to do OO php" the tutorial says. ... Should I use the composite pattern to successively add content to ... tutorials - german site, but english tutorials. ...
    (alt.php)
  • Re: Abstract Factory and Factory Method PHP5 Design Patterns
    ... Hey pattern fans, I just finished my page for the Memento Pattern ... called with the originator it was getting or setting, ... in C++ is not availble in PHP, or in Java for that matter. ...
    (comp.lang.php)
  • RE: [PHP] preg_match problem
    ... Because you're using forward slashes /.../ to delimit your pattern, regexp is using the / in your character class to terminate your pattern: ... Even if you had a character there that it could accept as a pattern modifier, the character class would be incomplete so the pattern is doomed to fail. ... PHP is reducing this to a single backslash before the space character. ... I think you intend this to be two backslashes in the pattern so you need four backslashes in PHP: ...
    (php.general)
  • |Flag-FAQ| Re: not getting OO
    ... learning php. ... i see the functionality that defining functions can give me. ... if i have a class Customer ... The mentioned pattern here is "Active record pattern" ...
    (comp.lang.php)