Thread: Regex a value?

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    23
    Rep Power
    0
    How do I use a regex as a value?
    Look at the following example.

    blahblah.+

    I want the ".+" to be a value of a variable, can anyone tell me how to do that??

    ------------------
    C.K.C.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    Use the chr() function. It converts from ascii....

    <?
    for ($i=1; $i < 254; $i++)
    {
    ?>
    <BR> The character for number <? print ($i) ?> is <? print(chr($i) . chr(13));?>
    <?
    }
    ?>
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    8
    Rep Power
    0
    I think what you want is:

    $yourstring = "blahblah.+";

    eregi(".+", $yourstring, $result);

    print $result[0];

Similar Threads

  1. regex to strip C comments?
    By pattonme in forum Perl Programming
    Replies: 3
    Last Post: January 1st, 2004, 10:37 PM
  2. compile php to use system regex and apache2
    By edman007 in forum PHP Development
    Replies: 0
    Last Post: November 7th, 2003, 07:11 PM
  3. Need help on regex?
    By trendmatrix in forum HTML Programming
    Replies: 1
    Last Post: August 2nd, 2003, 04:54 PM
  4. Replies: 1
    Last Post: October 30th, 2001, 11:42 AM
  5. which regex approach is best
    By bumperbox in forum Perl Programming
    Replies: 3
    Last Post: August 30th, 2001, 05:05 PM

IMN logo majestic logo threadwatch logo seochat tools logo