Let's be a bit more general and a bit more specific.
I looked at data under DOS and saw it was a box :), so each line is either nearly all non-word chars (top/bottom), or one either side of content you want. So:
# clean lines with words in
$text =~ s/.*? # anything
(?: # don't remember me
(\w.*\w) # everything from first to last word charac
+ter
# on the line - remember this
| # or
[^\w\s]{6,} # at least 6 characters that aren't words o
+r
# spaces (in a row) - forget me
)
.* # the rest of the line
/$1/gx; # replace whole line with (\w.*\w) match,
# if made.
Now, if your text contains puntuation, you might want to amend the (\w.*\w) match to take account of commas, etc that may appear at the end of a line:
(\w.*\w) => ([\w\.,].*[\w\.,])
if text contained only commas and periods.
cLive ;-)
ps - IANAL (I am not a lecythis)
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.