use strict;
my $str = 'The following fees and deposits are charged by the property at time of service, check-in, or check-out.
Breakfast fee: between AUD 9.95 and AUD 20.00 per person (approximately)
Fee for in-room wireless Internet: AUD 0.00 per night (rates may vary)
Fee for in-room high-speed Internet (wired): AUD 9.95 per night (rates may vary)
Fee for high-speed Internet (wired) in public areas: AUD 9.95 per night (rates may vary)
Late check-out fee: AUD 40
Rollaway beds are available for an additional fee
Onsite credit card charges are subject to a surcharge
The above list may not be comprehensive. Fees and deposits may not include tax and are subject to change.';
my $regex = qr/([^\?]*)AUD (\d*)/p;
if ( $str =~ /$regex/ ) {
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