There are three dashes in your example, not two. And a previous poster's comments about escaping the dash apply. So I'm unsure just what you're trying to do. Still, you're wanting to change the greedy behavior of [...]{1,75}. Check out
What does it mean that regexes are greedy? in perlfaq6
throop
update: you've added more examples, so let me give you some more comments –
Are you ever going to have line breaks in your titles?
Are all your titles going to start with GRP?
I suggest:
m| \s* GRP \- \d+ (?: \s? \-\d+) # The GRP intro
\s+ \- \s+ # The dash
[\w\s\d()\-,]{1,75} # I have doubts about this
<\/title> |xms
If this looks unfamiliar, check out
How can I hope to use regular expressions..
I have some doubts that you really want the spec
[\w\s\d()\-,]{1,75}. That is, are you really confident that you're not going to see a line like
<title> GRP-124-9 - Alkaline Rust Remover Solution (Yugo HTP-1150L - R
+ust & Stain Remover)</title>
and lose on the '&'?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.