Jump to content

feha

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.vision.to

Profile Information

  • Gender
    Not Telling
  • Location
    Sweden

feha's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, Im stuck with this and need some help. SELECT COUNT(id) AS counter FROM time_reporter WHERE user_id='$user_id' AND actual_date = '$date' AND ((start_time > '$start_time' AND end_time < '$end_time')) It checks ok if in range but i need to make sure if there is a record start , end time so next record could not be inserted ... if one record has end_time example 22:30 the next record can not have start_time 22:15 etc ... so with this i cant get is count ... any help appreciated Thank You
  2. I fixed ... preg_replace needs e modifier at the end ...
  3. I have tried this: $content = preg_replace( '/(title|alt)="([^>]*)"/is', '\\1="'.str_replace('"','&quote;','\\2').'"', $content ); but it does not replace quotes within $2 variable ... :-(
  4. Hi the code is below <div class="item_image"><img src="images/sample1.gif" alt="14 Tips for "Crate Training" Your New Puppy"/></div> I can't fix regex to remove quotes within quotes as I'm parsing a content before output ... The situation above will produce invalid xhtml ... I ned to replace quotes between quotes or remove them in order to get valid html ... replacement could be &quote; ow no quote at all if within quotes ... Thank you in advance
  5. I solved this by using : foreach ($out as $key => $value) { if ($out[$key] != '') { $temp[] = $value ; } } $out = $temp; But i wonder if there is other way ...
  6. Hi, I still have some problems ... my current code is: $pattern = "/([a-z]+)\(([0-9]+)\)([a-z]+)|([a-z]+)\(([0-9]+)\)|([a-z]+)/i"; $type = 'int (20) unsigned'; //$type = 'int(20)'; //$type = 'text'; $type = preg_replace('/\s+/','', $type); if(preg_match($pattern, $type, $out)) { echo 1; } echo "<pre>".print_r($out,true); so far it works ok as OR ... if i try: $type = 'int(20) unsigned'; iget Array ( [0] => int(20)unsigned [1] => int [2] => 20 [3] => unsigned ) if i try $type = 'int(20)'; Array ( [0] => int(20) [1] => [2] => [3] => [4] => int [5] => 20 ) an if i try : $type = 'text'; i get: Array ( [0] => text [1] => [2] => [3] => [4] => [5] => [6] => text ) it works, but the problem is i want to use just [1],[2],[3] without having empty values ... is the possible just with RegEX ... Thank you in advance ...
  7. Hello again ... Have still some problems ... $type = 'int'; if(preg_match('/([a-z]+)\(([0-9]+)\)/i', $type, $out)) { } else { preg_match('/([a-z]+)/i', $type, $out); } print_r($out); Is it possible to make it in one pass, regex ... as some times values are: int(10) unsigned, text date not just varchar(250) etc ... so it should match something like: txt int(10) int(10) unsigned but still to get matches ... is this possible with single regex line ? Thank you f
  8. Hi cag, Thank you very much, this works great :-)
  9. Thanks, this is better :-) $s = 'varchar(250)'; $result = preg_split('#([a-z]+)\(([0-9]+)\)#i', $s, 0, PREG_SPLIT_DELIM_CAPTURE); print_r($result); I get: Array ( [0] => [1] => varchar [2] => 250 [3] => ) btw the first 0 and last is empty ... result should be something as : Array ( [0] => varchar [1] => 250 ) or ?
  10. Hi cags, thank you, I'm getting an error: Compilation failed: unmatched parentheses at offset 18 don't know why ...
  11. I fixed this way: $s = 'varchar(250)'; $result = preg_split('/([0-9]+)/i', $s, -1, PREG_SPLIT_DELIM_CAPTURE); print_r($result); and getting: Array ( [0] => varchar( [1] => 250 [2] => ) ) That's not right result ... :-(
  12. Also: Getting as $value1 = "varchar" and $value2 ="250" is OK ...
  13. Hi, I'm collecting info of the MySQL table structure, so far im getting nice array as below: What I need help with is a regex to extract values from : [Type] => varchar(250) and get them as : [Type] => array('varchar' => '250') ... Any help appreciated, thank you in advance ...
  14. feha

    preg_replace ?

    Hi I would like if input string has other values than allowed with regex strip out ... example: $original = preg_replace("/[^a-zA-Z0-9]/","",$original); this removes all non alphanummerics ... but i want if user name starts with - or end's with - also to be replaced ....
  15. feha

    preg_replace ?

    Hi I have another problem with this regex ... http://www.phpfreaks.com/forums/index.php/topic,268024.0.html It works great for validation (preg_match) but how if i want to use it as preg_replace ? What do I need to change ? /^[a-zA-Z0-9](?:[a-zA-Z0-9]|(?!--)-){1,48}[a-zA-Z0-9]$/
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.