Regular Expression Help please



Please help.

I need a regular expression that parses a stream of up to 450 characters
into 15 separate strings of up to 30 characters each. The regex must break
at newlines. Ideally, the regex will "word wrap" that is, not break in the
middle of words. I have the following:

(?m:(?:(.)?){1,30}\s\n?){1,15}?

This works well as long as the user leaves at least one whitespace character
at the end. Without this, the last word is omitted from the match.

How might this be altered to avoid missing the last word?


.



Relevant Pages

  • Re: Standard C Library regex performance issue
    ... except for the number of characters you have to type in. ... To specify more than one option, "or" them together with the | operator: ... By default, Python's regex engine only considers the letters A through Z, the ... The above implies that Pyhton's newline mode is *ON* by default. ...
    (comp.lang.c)
  • Re: Help with Regex (UserName, Email)
    ... I have a feeling you haven't tried regex till now, ... If Name = ALL recurring characters, excluding spacing, ... ShowMessage: Please re-enter the Name again. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Regex question
    ... I didn't know the range would be that much different from SQL ... The problem is that my regex only gets ... should write a regex pattern that matches _that_, ... remove all the characters from the string that aren't digits or '/' ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Usename regex
    ... which have alphanumberic characters and one underscore. ... From what I understand is I can use a regex to do this. ... Think of a string, preferably very long that contains only alphanumeric characters, but end in a # sign. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Splitting a string with Regex and keep the separator
    ... I want also to thank you for the regex explanation. ... a key/val pair. ... If this group captures multiple tokens they're added to the ... is made up of one or more alphanumeric characters. ...
    (microsoft.public.dotnet.languages.csharp)