Jump to content

msaspence

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

msaspence's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. prehaps if i give a more precise example i want to find a certain tag with a cetain id, class and title so i might use /<div id="mydiv" class="myclass" title="mytitle".*>[^<]*</div> but this requires the id class and title attribute to be in a specified order which they might not nessassarily be
  2. how would i match a string that contains xyz and abc but in no particular order for example both aslkdjf abc kasjdfakj xyz adflkjadsf and aslkdjf xyz kasjdfakj abc adflkjadsf would match i know that in this example i could use | with both combinations but if i wanted to expand this to match xyz, abc, mno and qrs the number of combinations would be huge
  3. Does any one know of a function that can be used to search a string for html tags using a css selector
  4. i need to pull some segments out of a file (loaded into a variable) the segments i need to pull out is basically anything in brackets what makes its esp hard is the brackets are not your standard () [] or {}, the closing bracket character is in fact two characters for example from the string: £a£b£c!£d!£e!£ f £g!£ where £ equates to ( and !£ equates to ) i want to extract £a£b£c!£d!£e!£ and £g!£ as matches so far i have got to: $string = " §b§c;§d;§"; if(preg_match_all("/(?<!§([^()]+|(?R))*(?<=§/U",$string,$matches)) { echo "<pre>"; print_r($matches[0]); echo "</pre>"; } which returns Array ( [0] => £a£b£c!£ [1] => £g!£ ) the first match is missing the d and e parts Any clues on a solution would be really appreciated
  5. im having a real problem with character encoding and php i aware that php has some problems with character encoding but i dont really understand them whats got me even more stumped is that when i was developing the same thing on my pc i never had this problem im now on a mac whats more the problem only seems to happen when using the rewrite rule in the htaccess? basically if i have an file index.html and it is <?php echo "£"; ?> it echos a £ sign fine if however i use an htaccess file to redirect any request to another file lets say invoke.html and it has the same thing it outputs £ i know for this example i should just echo £ but this isnt exactly what im trying to do this is just the simpliest example of the problem what im actually doing is fopen fread a file then using strpos to find any £ symbols the £ symbols in the file are just £ symbols if i echo the read file contents they output as just £ symbols however if i put "£" in as the needle for strpos it goes in as £ and therefore doesnt find it in the haystack any ideas on why this is or how i might fix it would be really appreciated
  6. I'm having a problem with the ereg function to verify a user submitted variable the situation is that the user is submitting a textarea post variable there are a number of allowed characters there are more in the actual application but i have removed to demonstrate the problem as removing them makes no difference the php code is as follows $message=$_POST['textarea1']; if (ereg("^[A-Za-z0-9\n]*$",$message)) { $textValid=TRUE; } else { echo "error"; } but it seems to act like $message=$_POST['textarea1']; if (ereg("^[A-Za-z0-9]*$",$message)) { $textValid=TRUE; } else { echo "error"; }
×
×
  • 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.