I'm trying to write a Regexp for php to scan true files, the keyword is require
and the string I want is in brackets "my string"
(require would be reserved) example
File1.txt
require "testing/this/out.js"
require "de/test/as.pen"
require "my_love.test"
.....
print "I require coffee in the morning" //problem
- The requires will be at the top of the page.
- Follow the standard
require "_String_"
format
File2.txt
Class Ben extends Name
....
print "My good boss always extends my deadline" //problem
- Extends would only be follow by class name
- Is only one word and only one result
// looping true and determining if class or if reg file by folder structure
$subject = "Code above";
$pattern = '/^require+""/i'; // Not sure of the correct pattern
preg_match($pattern, $subject, $matches);
print_r($matches);
I just want testing this out
and de/test/as.pen
to return in an array for the first example.
Is this possible? will there be a lot of problems with this?