Professional Web Applications Themes

[PHP] strings - PHP Development

* Thus wrote Anthony Ritter (tonygonefishingguideservice.com): > Curt Zirzow wrote in message: > > > This exact thing was talked about earlier today, with the subject > > 'Using eregi_replace()'. > ........................ > > Right. > > However, I've tried using the following code in which the text from the URL > is printed out completely and then I change the variable from $contents to > $text and using the line with preg_replace(), it still outputs the complete > text without the pattern match. hm.. I sort of misunderstood, preg_replace isn't what you need. use preg_match instead. I did some ...

  1. #1

    Default Re: [PHP] strings

    * Thus wrote Anthony Ritter (tonygonefishingguideservice.com):
    > Curt Zirzow wrote in message:
    >
    > > This exact thing was talked about earlier today, with the subject
    > > 'Using eregi_replace()'.
    > ........................
    >
    > Right.
    >
    > However, I've tried using the following code in which the text from the URL
    > is printed out completely and then I change the variable from $contents to
    > $text and using the line with preg_replace(), it still outputs the complete
    > text without the pattern match.
    hm.. I sort of misunderstood, preg_replace isn't what you need. use
    preg_match instead.

    I did some testing you can see the code and results here:
    [url]http://zirzow.dyndns.org/html/php/tests/preg/p_doc.php[/url]
    > $newtext= preg_replace("!.*?(REGIONAL.*YORK).*!","$1",$text) ;
    btw, there these should be single quotes ~~~~~~~~~~^ ^

    or "\$1" so php doesn't expand the variable (even though its an
    illagal php var name.)


    HTH,

    Curt
    --
    "I used to think I was indecisive, but now I'm not so sure."
    Curt Zirzow Guest

  2. #2

    Default Re: [PHP] strings

    Curt Zirzow writes:
    > I did some testing you can see the code and results here:
    > [url]http://zirzow.dyndns.org/html/php/tests/preg/p_doc.php[/url]
    ...................

    Thanks Curt.

    I checked it out and I still pick up the following lines which I was looking
    to delete on the pattern match.

    They are:
    ..............
    Expires:No;;725283 //line 1
    AWUS41 KALY 012014 //line 2
    RWSALB // line 3
    ..................

    It could be that when the URL file is being opened and read that these
    characters are on _three_ different_ lines as opposed to one line/string and
    the match is not being met.

    I was looking to delete those lines and to start the match at REGIONAL.

    Best...
    TR



    Anthony Ritter Guest

Similar Threads

  1. Difference between strings
    By JMNUSS in forum Microsoft SQL / MS SQL Server
    Replies: 11
    Last Post: February 11th, 11:26 PM
  2. Extracting strings delimited by other strings
    By Scott Bass in forum PERL Modules
    Replies: 2
    Last Post: May 7th, 02:26 AM
  3. Zero length strings
    By William E Hatto in forum ASP Database
    Replies: 4
    Last Post: June 13th, 02:52 PM
  4. strings
    By James Brown in forum Microsoft Access
    Replies: 5
    Last Post: February 14th, 07:05 PM
  5. replacing everything between 2 strings
    By Matt Palermo in forum PHP Development
    Replies: 1
    Last Post: July 22nd, 01:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139