Output: Antler South Street Avebury Wiltshire England Comment Collagenuse Modern::Perl; my $data = "Antler embedded in mound at South Street, Avebury, Wiltshi +re, England. Comment (lab): Collagen fraction used"; my @results = $data =~ /\b[[:upper:]][[:lower:]]*?\b/g; say "@results";
If you feed it the string "Paroží zakotven v kopci na South Street, Avebury, Wiltshire, Anglie. Komentář (laboratoř): Kolagenní frakce používané" it will return "Paroží South Street Avebury Wiltshire Anglie Komentář Kolagenní".
Update: And if you want to match "words" like "USA", "UK" or "Test5", "Body2Body" and such you can use /\b[[:upper:]][[:upper:][:lower:][:digit:]]*?\b/g as the regex.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: Help composing Regex for matching only Titlecase words
by CountZero
in thread Help composing Regex for matching only Titlecase words
by seand
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |