Jump to content

regular expressions for get script code

- - - - -

  • Please log in to reply
6 replies to this topic

#1
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Hi guys,

This Code in other web site, and i get with file_get_contents

BUGCBET[1]=Array(00121,"ANLLX",23423,"MAX");SUMCP[1]=Array("-","","","","","","");SUCX[3213]=Array(1,3,5,71);SUCX[1212]=Array(4657,1,12,12);nulxad="jhsadywd";loadsa=54545;


I want a regular expression fors get this code only:

SUMCP[1]=Array("-","","","","","","");


Help me please

thank you

#2
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Without a few different cases of what kind of data is in that array, I'll assume the end thing is unique ")"
[noparse](SUMCP([^\)]+)\);)[/noparse]

Edit: Smiley face? why?!

#3
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
i cant see output

preg_match('#SUMCP([^\)]+)\);#', $get, $matches);

#4
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Works fine for me:
<?PHP
$get = 'BUGCBET[1]=Array(00121,"ANLLX",23423,"MAX");SUMCP[1]=Array("-","","","","","","");SUCX[3213]=Array(1,3,5,71);SUCX[1212]=Array(4657,1,12,12);nulxad="jhsadywd";loadsa=54545;';
preg_match('#SUMCP([^\)]+)\);#', $get, $matches);
print_r($matches);
/*
    Array
    (
        [0] => SUMCP[1]=Array("-","","","","","","");
        [1] => [1]=Array("-","","","","","",""
    )
*/


#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
lol33d, have you made any attempt to learn how to craft your own regular expressions? or do you expect other people to always do them for you?

#6
lol33d

lol33d

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
I am try to learn

#7
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
Maybe next time show us what you have, and we can show you where you are going wrong.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users