amacks has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to extract the beginning of an HTML string, in a way that returns legal HTML, basically to generate a summary page of blog entries for the index. For an example entry
First a technological update - The code that drives this site is avail +able for free on <a href="https://github.com/amacks/vatican_mss">GitH +ub</a>. I've just merged in a rather complex change to create proper + shelfmark sorting, fixing things like numbers-stored-as-strings and +handling roman numerals. Two problems yet unfixed are Fonds <strong> +P.I.O</strong>, with the middle "I" reading as a roman numeral, and < +strong>Arch.Cap.S.Pietro</strong> where sub-set "I" is read as roman +1 and everything gets confused.</p>...
a naive perl substr($_,0,100), returns text ending "free on <a href="htt", which is bad
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Truncate HTML String
by Your Mother (Archbishop) on Dec 04, 2019 at 15:26 UTC |