Sipatshi: Regex

Beitrag lesen

Hey Ho Allwissender :)

Du hast einen Ausdruck mit einem binären Oder notiert - oder vergessen, ein Paar ' zu maskieren.

jep, eines von beiden war es, thnx :)

Interessant, interessant was man mit dem Tokenizer alles so anstellen kann. Echt cool ! Da gebe ich dir recht, das Reguläre-Ausdrücke überflussig sind wenn die Bereiche lokalisiert werden sollen die mit 'o(' beginnen und mit ';' enden oder innerhalb einer Funktion/While aufgerufen werden. Ich bin dir sehr sehr Dankbar :)

Ergebniss:

array (size=3)
  0 => int 372
  1 => string '<?' (length=2)
  2 => int 1

array (size=3)
  0 => int 375
  1 => string '

    ' (length=10)
  2 => int 1

array (size=3)
  0 => int 370
  1 => string '# use oopRuntime as file;
' (length=26)
  2 => int 3

array (size=3)
  0 => int 375
  1 => string '
    ' (length=5)
  2 => int 4

array (size=3)
  0 => int 316
  1 => string 'echo' (length=4)
  2 => int 5

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 5

array (size=3)
  0 => int 307
  1 => string 'o' (length=1)
  2 => int 5

string '(' (length=1)

string '[' (length=1)

array (size=3)
  0 => int 315
  1 => string '"test1"' (length=7)
  2 => int 5

string ',' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 5

string '[' (length=1)

array (size=3)
  0 => int 315
  1 => string '"test2"' (length=7)
  2 => int 5

string ',' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 5

array (size=3)
  0 => int 315
  1 => string '"test3"' (length=7)
  2 => int 5

string ']' (length=1)

string ']' (length=1)

string ')' (length=1)

string '[' (length=1)

array (size=3)
  0 => int 305
  1 => string '1' (length=1)
  2 => int 5

string ']' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 5

array (size=3)
  0 => int 307
  1 => string 'shuffle' (length=7)
  2 => int 5

string '(' (length=1)

string ')' (length=1)

string '[' (length=1)

array (size=3)
  0 => int 305
  1 => string '0' (length=1)
  2 => int 5

string ']' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 5

array (size=3)
  0 => int 307
  1 => string 'ucfirst' (length=7)
  2 => int 5

string '(' (length=1)

string ')' (length=1)

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '

    ' (length=6)
  2 => int 5

array (size=3)
  0 => int 354
  1 => string 'class' (length=5)
  2 => int 7

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 7

array (size=3)
  0 => int 307
  1 => string 'Foo' (length=3)
  2 => int 7

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 7

string '{' (length=1)

array (size=3)
  0 => int 375
  1 => string '

        ' (length=18)
  2 => int 7

array (size=3)
  0 => int 343
  1 => string 'public' (length=6)
  2 => int 9

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 9

array (size=3)
  0 => int 309
  1 => string '$tmp' (length=4)
  2 => int 9

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 9

string '=' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 9

array (size=3)
  0 => int 307
  1 => string 'null' (length=4)
  2 => int 9

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '

        ' (length=18)
  2 => int 9

array (size=3)
  0 => int 343
  1 => string 'public' (length=6)
  2 => int 11

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 11

array (size=3)
  0 => int 334
  1 => string 'function' (length=8)
  2 => int 11

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 11

array (size=3)
  0 => int 307
  1 => string '__construct' (length=11)
  2 => int 11

string '(' (length=1)

array (size=3)
  0 => int 309
  1 => string '$tmp' (length=4)
  2 => int 11

string ')' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 11

string '{' (length=1)

array (size=3)
  0 => int 375
  1 => string '
            ' (length=13)
  2 => int 11

array (size=3)
  0 => int 309
  1 => string '$this' (length=5)
  2 => int 12

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 12

array (size=3)
  0 => int 307
  1 => string 'tmp' (length=3)
  2 => int 12

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 12

string '=' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 12

array (size=3)
  0 => int 309
  1 => string '$tmp' (length=4)
  2 => int 12

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '
        ' (length=9)
  2 => int 12

string '}' (length=1)

array (size=3)
  0 => int 375
  1 => string '
        ' (length=9)
  2 => int 13

array (size=3)
  0 => int 343
  1 => string 'public' (length=6)
  2 => int 14

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 14

array (size=3)
  0 => int 334
  1 => string 'function' (length=8)
  2 => int 14

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 14

array (size=3)
  0 => int 307
  1 => string 'init' (length=4)
  2 => int 14

string '(' (length=1)

string ')' (length=1)

string '{' (length=1)

array (size=3)
  0 => int 375
  1 => string '

            ' (length=26)
  2 => int 14

array (size=3)
  0 => int 309
  1 => string '$res' (length=4)
  2 => int 16

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 16

string '=' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'o' (length=1)
  2 => int 16

string '(' (length=1)

array (size=3)
  0 => int 309
  1 => string '$this' (length=5)
  2 => int 16

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'tmp' (length=3)
  2 => int 16

string ')' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'explode' (length=7)
  2 => int 16

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"|"' (length=3)
  2 => int 16

string ')' (length=1)

string '[' (length=1)

array (size=3)
  0 => int 305
  1 => string '1' (length=1)
  2 => int 16

string ']' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'strtolower' (length=10)
  2 => int 16

string '(' (length=1)

string ')' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'pregMatch' (length=9)
  2 => int 16

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"/Was/"' (length=7)
  2 => int 16

string ')' (length=1)

string '[' (length=1)

array (size=3)
  0 => int 305
  1 => string '0' (length=1)
  2 => int 16

string ']' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 16

array (size=3)
  0 => int 307
  1 => string 'strtolower' (length=10)
  2 => int 16

string '(' (length=1)

string ')' (length=1)

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '

            ' (length=14)
  2 => int 16

array (size=3)
  0 => int 301
  1 => string 'if' (length=2)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 307
  1 => string 'o' (length=1)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"Hallo"' (length=7)
  2 => int 18

string ')' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 18

array (size=3)
  0 => int 307
  1 => string 'pregMatch' (length=9)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"Ha"' (length=4)
  2 => int 18

string ')' (length=1)

string ')' (length=1)

string '{' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 18

array (size=3)
  0 => int 316
  1 => string 'echo' (length=4)
  2 => int 18

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 18

array (size=3)
  0 => int 315
  1 => string '"hallo"' (length=7)
  2 => int 18

string ';' (length=1)

string '}' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 18

array (size=3)
  0 => int 301
  1 => string 'if' (length=2)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 307
  1 => string 'o' (length=1)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"Hallo"' (length=7)
  2 => int 18

string ')' (length=1)

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 18

array (size=3)
  0 => int 307
  1 => string 'pregMatch' (length=9)
  2 => int 18

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"Ha"' (length=4)
  2 => int 18

string ')' (length=1)

string ')' (length=1)

string '{' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 18

array (size=3)
  0 => int 316
  1 => string 'echo' (length=4)
  2 => int 18

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 18

array (size=3)
  0 => int 315
  1 => string '"hallo"' (length=7)
  2 => int 18

string ';' (length=1)

string '}' (length=1)

array (size=3)
  0 => int 375
  1 => string '


        ' (length=23)
  2 => int 18

string '}' (length=1)

array (size=3)
  0 => int 375
  1 => string '
    ' (length=5)
  2 => int 21

string '}' (length=1)

array (size=3)
  0 => int 375
  1 => string '

    ' (length=6)
  2 => int 22

array (size=3)
  0 => int 309
  1 => string '$o' (length=2)
  2 => int 24

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 24

string '=' (length=1)

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 24

array (size=3)
  0 => int 299
  1 => string 'new' (length=3)
  2 => int 24

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 24

array (size=3)
  0 => int 307
  1 => string 'Foo' (length=3)
  2 => int 24

string '(' (length=1)

array (size=3)
  0 => int 315
  1 => string '"Hallo|Was|Geht|Ab"' (length=19)
  2 => int 24

string ')' (length=1)

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '
    ' (length=5)
  2 => int 24

array (size=3)
  0 => int 316
  1 => string 'echo' (length=4)
  2 => int 25

array (size=3)
  0 => int 375
  1 => string ' ' (length=1)
  2 => int 25

array (size=3)
  0 => int 309
  1 => string '$o' (length=2)
  2 => int 25

array (size=3)
  0 => int 359
  1 => string '->' (length=2)
  2 => int 25

array (size=3)
  0 => int 307
  1 => string 'init' (length=4)
  2 => int 25

string '(' (length=1)

string ')' (length=1)

string ';' (length=1)

array (size=3)
  0 => int 375
  1 => string '

' (length=6)
  2 => int 25

array (size=3)
  0 => int 374
  1 => string '?>' (length=2)
  2 => int 27

Gruß

Sipatshi