I have a file I am reading into a
string since it contains multiple line returns. The file is a basic php file and all I want from it are the name value pairs.
textFile:
$test1 = "test1"; // this is
test 1
$test2 = "test2"; // this is test 2
$test3 = "test 3 with new line
new line
newline"; // test 3 end
When loaded in a string it looks like:
$test1 = "test1"; // this is test 1$test2 = "test2"; // this is test 2 $test3 = "test 3 with new line new line newline"; // test 3 end
My thought was to capture everything between the $ and the semi-colon (;) for an enumeration by splitting on the equal sign so I can use the data downstream.
So far I have for testing
Pattern pattern = Pattern.compile("\\$*\\;");
Matcher matcher = pattern.matcher(textFile);
But all I get is just the semi-colon. As you can tell, I am new to both
Java and RegExs. Any thoughts on approach? I may be totally messed up by putting the file into a string as well.
Thanks
Mike