Feb 04, 2013, 9:16 PM
[CLOSED] Regex evaluation freezes the browser
Hi,
Regex evaluation execution hangs on my page when entering invalid characters under certain circumstances. I'm using IE9 to test. Please consider the basic code sample below and follow these steps to reproduce the issue:
The problem is much more pronounced in my application whereby the page hosting the modal window is loaded with other controls and client side code. Sometimes, it takes close to a minute for the browser to "unfreeze" after Regex evaluation. Please suggest what maybe the cause.
Regex evaluation execution hangs on my page when entering invalid characters under certain circumstances. I'm using IE9 to test. Please consider the basic code sample below and follow these steps to reproduce the issue:
- Start Task Manager
- Click on the button to bring up the modal window
- Place the cursor inside the text box
- Complete the word "document" in the text box
- Observe no issue with Regex evaluation processing time and CPU usage
- Place the cursor at the end of the text string
- Type in a backslash or ampersand character
- Notice a slight delay in evaluation and a spike in CPU cycles
The problem is much more pronounced in my application whereby the page hosting the modal window is loaded with other controls and client side code. Sometimes, it takes close to a minute for the browser to "unfreeze" after Regex evaluation. Please suggest what maybe the cause.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" SourceFormatting="True"
ScriptMode="Debug" />
<ext:Window ID="Window1" runat="server" Title="Hello World!" Icon="Application" Height="400px"
Width="600px" BodyStyle="background-color: #fff;" Padding="5" Collapsible="true"
Hidden="true" Modal="true">
<Items>
<ext:ColumnLayout ID="ColumnLayout1" runat="server" Split="false" FitHeight="true">
<Columns>
<ext:LayoutColumn ColumnWidth="0.25">
<ext:Panel ID="Panel1" runat="server" Html="<div style='font-weight:bold;font-size:9pt;margin:5px;margin-top:27px;'>Select the Title for this new document:</div>"
BodyCssClass="my-panel-body" />
</ext:LayoutColumn>
<ext:LayoutColumn ColumnWidth="0.75">
<ext:Panel ID="Panel2" runat="server" Border="true" Frame="false" Layout="FormLayout"
Padding="24">
<Items>
<ext:TextField runat="server" ID="TextFieldDocumentTitle" AnchorHorizontal="100%"
FieldLabel="Input text" Text="24 pages doc OCR-ed" Width="300" SelectOnFocus="true"
Regex="^([^&/?*:\"|<>\\]+)+$" RegexText="Invalid Document Title" AllowBlank="false"
BlankText="<nobr>Document Title is required</nobr>">
</ext:TextField>
</Items>
</ext:Panel>
</ext:LayoutColumn>
</Columns>
</ext:ColumnLayout>
</Items>
</ext:Window>
<ext:Button runat="server" Text="Show Window">
<Listeners>
<Click Handler="Window1.show();" />
</Listeners>
</ext:Button>
</body>
</html>
Last edited by Daniil; Feb 05, 2013 at 10:08 AM.
Reason: [CLOSED]