how to skip values and marks on string

Discussion in 'PHP' started by free-designer, Mar 1, 2010.

  1. #1
    hello guys,

    if there is a string like that

    ..Lorem$%#Dolor__Sit@#:Amet...__=%^*&

    okay this is a string i want to let php work with it to make it like that

    -Lorem-Dolor-Sit-Amet

    so what i need is to skip all of this kind of marks and specially dots with a dash

    thanks guys :)
     
    Last edited: Mar 1, 2010
    free-designer, Mar 1, 2010 IP
  2. krsix

    krsix Peon

    Messages:
    435
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    krsix, Mar 1, 2010 IP
  3. free-designer

    free-designer Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you so mush, that exactly what im looking for
     
    free-designer, Mar 1, 2010 IP
  4. free-designer

    free-designer Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    sorry guys but im haveing a problem here

    this function

    
        function skipURL($string){
    		$string = preg_replace("`\[.*\]`U","",$string);
    		$string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string);
    		$string = htmlentities($string, ENT_COMPAT, 'utf-8');
    		$string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string );
    		$string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $string);
    		return strtolower(trim($string, '-'));
    	}
    
    
    PHP:
    this works like what i need.

    but im haveing a problem this function works good with english language but what if there is any kind of other language

    like arabic for examble

    if i have this string with english

    LOREM _ DolOr :^*(

    the function going to make like that

    lorem-dolor

    but what if there a string like that

    english :: عربى

    it's going to be like that

    english

    i just want it to be like that

    english-عربى

    so please if anyone can help me with this

    thanks
     
    free-designer, Mar 2, 2010 IP
  5. free-designer

    free-designer Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    any ideas ??
     
    free-designer, Mar 3, 2010 IP