How do you divide paragraphs in English with regular expressions?

Source: Internet
Author: User

Groundwater is the word used to describe water that saturates the ground, and filling all the available spaces. The abundant type of groundwater is meteoric water; This is the groundwater, circulates as part of the water cycle. Ordinary meteoric water is water that have soaked into the ground from the surface, from precipitation (rain and snow) and From lakes and streams. There it remains, sometimes for long periods, before emerging at the surface again. At first thought it seems incredible that there can is enough space in the ' solid ' ground underfoot to hold all this water .

The necessary space is there, however, and many forms. The commonest spaces is those among the particles-sand grains and tiny pebbles-of loose, unconsolidated sand and gravel. Beds of this material, out of sight beneath the soil, is common. They is found wherever fast rivers carrying loads of coarse sediment once flowed. For example, as the great ice sheets this covered North America during the last ice age steadily melted away, huge volumes of water flowed from them. The water is always laden with pebbles, gravel, and sand, known as glacial outwash, which was deposited as the flow slowed Down.

The same thing happens to this day, though on a smaller scale, wherever a sediment-laden river or stream emerges from a mo Untain valley onto relatively flat land, dropping it load as the current slows:the water usually spreads out fanwise, de positing the sediment in the form of a smooth, fan-shaped slope. Sediments is also dropped where a river slows on entering a lake or the sea, the deposited sediments is on a lake floor Or the seafloor at first, but would be located inland at some for future date, when the sea level is falls or the land rises; Such beds is sometimes thousands of meters thick.

This is an article, I pass the regular expression is each paragraph in the P tag, the effect is as follows

......


What type of regular expression do you want to write to achieve this?

Reply content:

Groundwater is the word used to describe water that saturates the ground, and filling all the available spaces. The abundant type of groundwater is meteoric water; This is the groundwater, circulates as part of the water cycle. Ordinary meteoric water is water that have soaked into the ground from the surface, from precipitation (rain and snow) and From lakes and streams. There it remains, sometimes for long periods, before emerging at the surface again. At first thought it seems incredible that there can is enough space in the ' solid ' ground underfoot to hold all this water .

The necessary space is there, however, and many forms. The commonest spaces is those among the particles-sand grains and tiny pebbles-of loose, unconsolidated sand and gravel. Beds of this material, out of sight beneath the soil, is common. They is found wherever fast rivers carrying loads of coarse sediment once flowed. For example, as the great ice sheets this covered North America during the last ice age steadily melted away, huge volumes of water flowed from them. The water is always laden with pebbles, gravel, and sand, known as glacial outwash, which was deposited as the flow slowed Down.

The same thing happens to this day, though on a smaller scale, wherever a sediment-laden river or stream emerges from a mo Untain valley onto relatively flat land, dropping it load as the current slows:the water usually spreads out fanwise, de positing the sediment in the form of a smooth, fan-shaped slope. Sediments is also dropped where a river slows on entering a lake or the sea, the deposited sediments is on a lake floor Or the seafloor at first, but would be located inland at some for future date, when the sea level is falls or the land rises; Such beds is sometimes thousands of meters thick.

This is an article, I pass the regular expression is each paragraph in the P tag, the effect is as follows

......


What type of regular expression do you want to write to achieve this?

echo preg_replace('#([^\r\n]+)(?:\r\n)*#', '

$1

', $str);

[\r\n]+Replace the

, and at the end of the tail separately add

And

Just fine.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.