Results 1 to 4 of 4

Thread: Problem regarding PHP Programming Language

  1. #1
    Join Date
    Nov 2008
    Posts
    69

    Problem regarding PHP Programming Language

    hi there

    I am having a small query regarding php programming language. My question is What is the php regular expression to get everything before a certain character?

    Please help me regarding this problem

    Your views will be appreciated

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Problem regarding PHP Programming Language

    Whatever you place in your regular expression you want to encase in in parenthesis and those items will be returned in their own array...

    I can never get it first time around but I imagine it would be something like this.

    Code:

    preg_match('@table(.*?)[:]{1}(.*?)@si',$string,$matches);

    print('<pre>');
    print_r($matches);
    print('</pre>');

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Problem regarding PHP Programming Language

    function LimitText($Text,$Min,$Max,$MinAddChar) {
    if (strlen($Text) < $Min) {
    $Limit = $Min-strlen($Text);
    $Text .= $MinAddChar;
    }
    elseif (strlen($Text) >= $Max) {
    $words = explode(" ", $Text);
    $check=1;
    while (strlen($Text) >= $Max) {
    $c=count($words)-$check;
    $Text=substr($Text,0,(strlen($words[$c])+1)*(-1));
    $check++;
    }
    }

    return $Text;
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Problem regarding PHP Programming Language

    function explode_escaped($delimiter, $string){
    $exploded = explode($delimiter, $string);
    $fixed = array();
    for($k = 0, $l = count($exploded); $k < $l; ++$k){
    if($exploded[$k][strlen($exploded[$k]) - 1] == '\\') {
    if($k + 1 >= $l) {
    $fixed[] = trim($exploded[$k]);
    break;
    }
    $exploded[$k][strlen($exploded[$k]) - 1] = $delimiter;
    $exploded[$k] .= $exploded[$k + 1];
    array_splice($exploded, $k + 1, 1);
    --$l;
    --$k;
    } else $fixed[] = trim($exploded[$k]);
    }
    return $fixed;
    }

Similar Threads

  1. Google's Go programming language
    By Trio in forum Software Development
    Replies: 1
    Last Post: 07-06-2011, 12:12 AM
  2. What are HTA in Programming Language?
    By Silent~Kid in forum Software Development
    Replies: 4
    Last Post: 27-02-2010, 05:31 AM
  3. Socket programming: Is any new Programming Language?
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 11:13 AM
  4. Best Programming Language To Learn First?
    By Baker in forum Software Development
    Replies: 4
    Last Post: 02-04-2009, 12:11 AM
  5. Recommend Programming language
    By go raiden in forum Software Development
    Replies: 3
    Last Post: 25-08-2008, 07:40 PM

Tags for this Thread

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
  •  
Page generated in 1,713,280,683.55077 seconds with 17 queries