split a paragraph

Results 1 to 2 of 2

Thread: split a paragraph

  1. #1
    Join Date
    Dec 1969

    Default split a paragraph

    Regular Expression<BR>Posted: 12-09-2002 11:17 AM <BR>I am using regular expression to split a paragraph into sentences. I am using (.)s+([A-Z]) as my pattern. Everything works fine but I know only want to split after 1000 characters. In other words I need to split that paragraph in groups of sentace that are under 1000 characters. <BR><BR>Thanks, <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: split a paragraph

    You&#039;re probably using the noted RegExp pattern in conjunction with another technique to get your paragraphs cause alone that pattern won&#039;t work.<BR><BR>Try this pattern instead. In this pattern 20 represents the minimum paragraph length, use your own value here:<BR><BR>.{20}[^.]*.<BR><BR>Basically here, we&#039;ll take min characters, the look for anything other than a period, followed by a period. At least your paragraphs won&#039;t break abruptly.<BR><BR>Here is another interesting pattern that I was trying based on max length. I don&#039;t time to see if the results are accurate, you try it here: http://www.geocities.com/udeleng/regex.htm <BR><BR>.*.{0,150}<BR><BR>Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts