72386

How to Match Paragraphs in Text with regx

Question:

I need to extract all paragraphs from a text using regxp, so I figure to match first paragraph and iterate through all others, the problem I'm facing is I'm unable to make regxp to successfully match first paragraph, I would be forever grateful for help!

Answer1:

A Paragraph is a distinct section of a piece of writing,indicated by a new line, indentation, or numbering

So,you can do this

(\n|^).*?(?=\n|$)

Use this regex with singleline option

Recommend

  • How to match new lines as one?
  • JQuery: select paragraphs that only contain “ ” [duplicate]
  • How to escalate top-most supervisors in Akka?
  • Custom domains in a Rails App
  • How do I resolve an ImageSource IRandomAccessStream seeking not supported error?
  • How get paragraph FontName with Docx dll?
  • angular 2 group validation
  • XSLT 1.0: copy everything except certain nodes according to value and variable
  • Creating BackgroundSubtractorMOG2 in Android by OpenCV 3.0 RC1
  • How can I check the type of the next element?
  • How to transform Byte[](decoded as PNG or JPG) to Tensorflows Tensor
  • Crafting a LINQ based solution to determine if a set of predicates are satisfied for a pair of colle
  • Runtime error in UVA Online Judge [closed]
  • How to extract a number from a string [duplicate]
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • How to use the resource module to measure the running time of a function?
  • Lua: Line breaks in strings
  • Python/Javascript: WYSIWYG html editor - Handle large documents fast and/or design theory
  • Google Places API - Find a company's CID and LRD
  • msbuild create itemgroup from property group
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Invalid object name 'dbo.Item'
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • TextToSpeech.setEngineByPackageName() triggers NullPointerException
  • NSScanner Loop Question
  • Unable to install Git-core+svn by MacPorts
  • Unable to decode certificate at client new X509Certificate2()
  • Limiting recursion to certain level - Duplicate rows
  • Converting a WriteableBitmap image ToArray in UWP
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • Launch Runnable Jar from Web Start
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • MySQL WHERE-condition in procedure ignored
  • Join two tables and save into third-sql
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • Web-crawler for facebook in python
  • trying to dynamically update Highchart column chart but series undefined
  • Converting MP3 duration time
  • java string with new operator and a literal