I have a PHP array that I'm parsing to get email addresses. Sometimes I'll want to comment an entry so I can use a different value for testing.
Here's an example of the array:
array('system.email' => array(
'to' => array(
'contactus' => '[email protected]',
'newregistration' => '[email protected]',
'requestaccess' => '[email protected]',
// 'workflow' => '[email protected]'
'workflow' => '[email protected]'
)
));
Here's my PARSE rule:
parse read %config.php [
thru "'system.email'" [
thru "'to'" [thru "'workflow'" [thru "'" copy recipient-email to "'^/"]]
] to end
]
When I run that, the value of recipient-email
is "[email protected]". How can I write my rule such that it ignores the line that begins with //
?
A rule for eating up a comment line would look something like this:
You may judge how you want to do that with your current rule. Here's a somewhat messy way to deal with only comments in the array.
This will result in a block of the names and emails from the array.
Maybe a more holistic approach could process the source and remove all comments before parsing. This is a function I have used in the past: