Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

ASP.NET/VB/REGEX: Two New Lines or Carriage Returns in a Row

I use this REGEX to identify two lines in a row:
(\r\n\r\n)

Open in new window

I use it in this context:
input = RegularExpressions.Regex.Replace(input, "(?=.{1,999}\n)([\S\S]*(?:(?: [!\S!\S]+)*)?)(\r\n\r\n)", "<strong class=""top"">$1 ...</strong>" + VbNewLine )

Open in new window


The problem is that if the data was input using some operating systems that REGEX does not work.

How can I identify two new lines lines or carriage returns in a row regardless of the OS?
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Do you have an example of the output from the other OS?
Avatar of hankknight

ASKER

It does not apply the strong tag from the other OS.
What is the "other OS"? What is the input?
My question is this:


(\r\n\r\n)

Instead of that, what can I do to detect two new lines in a row OR two Carriage Returns in a row?
SOLUTION
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
A question mark solves it.