Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:14:52+00:00 2026-05-13T06:14:52+00:00

Is there a way to detect if there are 2 consecutive carriage returns in

  • 0

Is there a way to detect if there are 2 consecutive carriage returns in a string ontained from a textarea or multiline text box?

Here is the scenario:
In a text area, user enters ABCD “Enter” EFGHI “Enter” JKLMNOP “Enter” “Enter”. After the this I need to force click event of the button – not form.submit.

Here is the default.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Src="~/UserControls/Search.ascx" TagName="Search" TagPrefix="ucSearch" %>
<html xmlns="w3.org/1999/xhtml">;
<head runat="server"> 
<title></title> </head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager runat="server"></asp:scriptmanager>
<div>
<ucSearch:Search id="search1" runat="server" />
</div>
</form>
</body>
</html>

This is the Search.ascx page:

<script language="javascript">
var inputString function doit(){inputString =  document.getElementById("search1$txtSearchText").value;
if (inputString.match(/(\n\n|\r\r|\r\n\r\n)$/)) {
    document.getElementById("search1_btnFindAssets").click();
}

</script>

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Search.ascx.cs" Inherits="UserControls_Search"%> 
<asp:TextBox ID="txtSearchText" TextMode="MultiLine"onKeyPress="doit();" runat="server">
</asp:TextBox>
<br>
<asp:ButtonID="btnFindAssets"runat="server"Text="Find"onclick="btnFindAssets_Click">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:14:53+00:00Added an answer on May 13, 2026 at 6:14 am

    Yes, you can do this with a regular expression:

    if (s.match(/\r\r/)) { ... }
    

    The \r character matches carriage return. Maybe you mean line feed (\n)? You might also want to handle different type of new line ‘\r’, ‘\r\n’, or ‘\n’. You can do this like this:

    if (s.match(/\n\n|\r\r|\r\n\r\n/)) { ... }
    

    If you only want the match at the end of the string, use the regex symbol $:

    if (s.match(/\r\r$/)) { ... }
    

    or:

    if (s.match(/(\n\n|\r\r|\r\n\r\n)$/)) { ... }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to detect text wrapping in a textarea?
Is there a way to detect, from within the finally clause, that an exception
Is there any way to detect if the iPhone wakes up from sleep while
Is there a way to detect a callback request is from facebook or not
Is there a way to detect a click from MotionEvent s in Android? To
Is there a way to detect the EOF when reading from a TCP Socket
Is there a way to detect DOM change events? whether it be text replacement,
Is there a way to detect if the scrollbar from the ScrollViewer in a
Is there a way to detect whether a variable has been set from the
Is there a way to detect the Language of the OS from within a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.