use strict;
my $str = 'js/modern/redux/actions/open-file-in-new-window.js:
8 import { openWindow, maybeSetVariantRedirectDomainQueryParam } from \'@slack/infra/multi-window\';
9: import getPrimaryView from \'@slack/redux/stores/workspace-store/get-primary-view\';
10 import { isGovSlack } from \'@slack/utility/is-gov-slack\';
26 const teamId = getTeamId(team);
27: const conversationId = getPrimaryView(state);
28 let fileUrl = teamId
js/modern/redux/actions/open-shortcuts-menu.js:
10 import looksLikeChannelId from \'@slack/utility/looks-like-channel-id\';
11: import getPrimaryView from \'@slack/redux/stores/workspace-store/get-primary-view\';
12 import jumpToMessage from \'@slack/redux/actions/jump-to-message\';
25 const state = getState();
26: const primaryViewId = getPrimaryView(state);
27 ';
my $regex = qr/(?:(:\n\s))(?:\s|\n|(?:.(?!modern))*)*/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html