$re = '/(?:Subject:|Summary:)[^"]*"(.*?)"/i';
$str = 'exports.onAppointment = (appt, user, lang, isNew) ->
if not user then return Promise.reject "Appointment has no user."
moment.locale(lang)
start = moment(appt.when)
cal = new ICal()
console.log appt.when
cal.addEvent
start: start.toDate()
end: moment(start).add(2,"hours").toDate()
summary: "Continental showroom visit"
mail =
to: user.emailId
subject: if isNew then "New appointment" else "Appointment updated"
alternatives: [
contentType: "text/calendar",
contents: new Buffer(cal.toString()),
contentEncoding: "7bit"
]
template =
name: "booking"
lang: lang
locals:
name: "#{user.firstName} #{user.lastName}"
datetime: moment(appt.when).format("dddd Do MMMM [at] HH:mm A")
cancelurl: config.server.baseUrl + "/appointment/cancel/#{appt._id}"
emailClient.send2 mail, template';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php