Regular Expression Pattern Needed

Can anyone help me

I have a string

some text here <p> some more text <p><a href=\"a link\"> something</a> <br>else<br> a new line now <br>please<br> and another new <p>paragraph<p>

I want to check my string and if any of the text on a new line is less than 10 chars then make it bold

so it would output something like:

This is some very interesting text here that is longer than ten chars<p>

<strong>this isn't</strong><p>

this is some more long text here<br>

<strong>this is <a href="">short<a/></strong>

any gifted programmers out there?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


i.e. find a newline, followed by 1 to 10 characters which aren't a new line, followed by another newline

if this is found, put <strong> </strong> around the found string
stuayreAuthor Commented:
thanks vince

but I can't seem to get it to work properly with my text :( here's an example of the text I'm using,
I'd like:
History Main article: History of England
Politics Main article: Politics of England
Subdivisions Main article: Subdivisions of England
Geography Main article: Geography of England
List of towns in England
Economy Main article: Economy of England
Demographics Main article: Demographics of England
Culture Main article: Culture of England

all in the <strong> tag, is it possible?

(This article is about the nation of England. There is also England, Arkansas in the United States of America.)

England is the largest, the most populous, and the most densely populated of the nations that make up the United Kingdom of Great Britain and Northern Ireland.
The name "England" is derived from "Engla-lond" or "land of the Angles".
It is often incorrectly used as a synonym for Great Britain or the United Kingdom by some, which is inaccurate and can be offensive.
Other terms for England include "Blighty", from the Hindustani "bila yati" meaning "foreign"; "this Green and Pleasant Land", from William Blake's poem Jerusalem. "Albion" was used by writers such as Pliny the Elder and Ptolemy in the 1st century, in reference to the white (Latin: "alba") cliffs of Dover.
The Marquis de Ximenés, an 18th century diplomat, is credited with coining the phrase La perfide Albion, or "perfidious Albion", which is still heard from the French -- also an affectionate term, in its own way. It is also used by the Irish about the English but in a less affectionate manner, suggesting a degree of untrustworthiness. The Irish also refer to England as "pagan England".
<table border=1 cellpadding=2 cellspacing=0 align=right width=285px>
<tr><td style=background:#efefef; align=center colspan=2>
<table border=0 cellpadding=2 cellspacing=0>
<tr><td align=center width=140px>
<td align=center width=140px>

<tr><td align=center width=140px>(In Detail)
<td align=center width=140px>(Lions of England)
<tr><td align=center colspan=2 style=border-bottom:3px  ;>Royal motto: Dieu et mon droit (God and my right)
<tr><td>Official languages<td>None, but mostly English is used by public officials.
<tr><td>Area<br>&nbsp;- Total<td>Ranked 1st <br>130,395 km&sup2;
<tr><td>Population <br>&nbsp;- Total (2001) <br>&nbsp;- Density <td>Ranked 1st<br>49,138,831<br>377/km&sup2;
<tr><td>Unification<td>Egbert of Wessex (d.839) is often regarded as the first king of all England, though his true title was Bretwalda (High King). School histories of England tend to begin with the accession of William the Conqueror in 1066.
<tr><td>Currency<td>Pound Sterling
<tr><td>Time zone<td>UTC+0
<tr><td>National anthems<td>God Save the Queen, Land of Hope and Glory (unofficial), Jerusalem (unofficial)
<p><table border<tr><td align
<b>Table of contents</b> </td></tr><tr id='dfuhduifhdfhtocinside'><td align

1  History <BR>

2  Politics <BR>

3  Subdivisions <BR>

4  Geography <BR>

5  Economy <BR>

6  Demographics <BR>

7  Culture <BR>

8  Miscellaneous Topics <BR>

9  External links <BR>

Main article: History of England
Main article: Politics of England
England, as a significant political entity, ceased to exist with the Act of Union 1707, which created the Kingdom of Great Britain.  All of Great Britain has been ruled by the government of the United Kingdom between that date and 1999, when the first elections to the newly created Scottish Parliament and Welsh Assembly left England as the only nation in the Union with no representative body.
There are calls by some for an English Parliament to counteract what they see as a democratic imbalance. Many would have this parliament take the form of an all-England grand committee in the United Kingdom House of Commons rather than as a new body with separate elections.
The current Labour government favours the establishment of regional governments, claiming that England is too large to be governed as a sub-state entity.  It's currently unclear whether there is any significant support for this from the public, especially since people generally identify with counties, rather than regions that have little historical basis.
There is, however, substantial public support in several regions, particularly in the north of England. Referenda will take place on this issue, possibly some time in 2004, and consideration has still to be given to what powers regions would be granted, and what impact this may have on the powers of counties or central government.  Considerable disquiet was caused when changes were made to the system of counties in 1974.  
Unlike the other nations of the Kingdom, there is very little call for independence of England from the UK. This is overwhelmingly due to its dominance in the Union. Those groups that do campaign for such a thing tend to be right-wing organisations.
Main article: Subdivisions of England
Historically, the highest level of local government in England was the county.  These divisions had emerged from a range of units of old, pre-unification England, whether they were Kingdoms, such as Essex and Sussex; Duchies, such as Yorkshire, Cornwall and Lancashire or simply tracts of land given to some noble, as is the case with Berkshire.
These counties all still exist in, or near to their original form as the traditional counties. In many places, however, they have been heavily modified or abolished outright as administrative counties. This came about due to a number of factors.
The fact that the counties were so small meant, and still means, that there was no regional government able to co-ordinate an overarching plan for the area.  This was especially true in the metropolitan areas surrounding the cities, as the county lines were usually drawn up before the industrial revolution and the mass urbanisation of the country.
The solution was the creation of large metropolitan counties centred on cities. These were later broken up, with several other counties, into unitary authorities, unifying the county and district/borough levels of government.
London is a special case, and is the one Region which currently has a representative authority as well as a directly elected mayor. The thirty-two London boroughs remain the local form of government in the city.
Other than Greater London, the official Regions are:
North East England
North West England
Yorkshire and the Humber
West Midlands
East Midlands
East of England
South West England
South East England
The Regions hold very little power owing to their lack of accountability - regional authority is placed in the hands of unelected representatives of various interests. When, as seems likely, several Regions opt to replace these QUANGOs with elected assemblies, Local government in England will remain as variable and, some might say, confusing as ever.
Main article: Geography of England
England comprises most of the southern two-thirds of the island of Great Britain. It is bordered to the north by Scotland and to the west by Wales.<br>
Most of England consists of rolling terrain, but the country is more mountainous in the north. The dividing line between terrain types is usually indicated by the Tees-Exe line.<br>
The Channel Tunnel near Dover links England to the European mainland.
Major rivers:
Major cities:
 Newcastle upon Tyne
List of towns in England
Main article: Economy of England
Main article: Demographics of England
England is both the most populous and the most ethnically diverse country in the United Kingdom with around 49 million inhabitants, of which roughly a tenth are from non-White ethnic groups.<br>
This population is made up of immigrants who have arrived over millennia. The principal waves of migration have been in c. 600 BC (Celts), the Roman period (garrison soldiers from throughout the Empire), 350-550 (Angles, Saxons, Jutes), 800-900 (Vikings, Danes), 1066 (Normans), 1650-1750 (European refugees and Huguenots), 1880-1940 (Jews), 1950-1985 (Caribbeans, Africans, South Asians), 1985-present (East Europeans, Kurds, refugees).  
The general prosperity of England has also made it a destination for economic migrants particularly from Ireland and Scotland. This diverse ethnic mix continues to create a diverse and dynamic language that is widely used internationally.
Generally, an English person is someone who lives in England regardless of their racial origin. However, some people (including many south Asians and whites) use the label as only referring to those people of Anglo-Saxon origin - preferring to instead use "British" as a racially neutral label.  This is only possible due to the somewhat hazy distinction that many people in the country make between "England" and "Britain".
See also Population of England - historical population estimates
Main article: Culture of England
English literature
Sir Thomas Browne
English national football team, English Football League teams (Soccer)
National parks (England and Wales)
Food and Drink
 Miscellaneous Topics
English Law
 List of monarchs of England - Kings of England family tree
 List of English people
 Angeln (region in northern Germany)
 UK topics
 List of British postal codes
$string=preg_replace("\n([^\n]*\n[^\n]*Main article: [^\n]*)\n","\n<strong>\1</strong>\n",$string);
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

stuayreAuthor Commented:
thanks Vince,

I should have said that my text will change all the time, I need a generic preg_replace for strings < 10 (or whatever)

That does it... on my machine ;)
sorry, you'll need:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.