Page MenuHomePhabricator

Search and Replace makes browser barf on invalid regex
Closed, ResolvedPublic

Description

Author: wikibugs

Description:
Search and Replace regex error

Reporting against Babaco Release r57575.

Steps to reproduce::

  1. Edit a component string
  2. Search for "[^]he" and replace a string
  3. Click on Replace All

<<Replace is not happen>>

Expected output::
Replace should be done

Test Environment::
Browser (User-Agent): Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)
Time and Date: 3:55:22 AM - Monday, October 12, 2009
Javascript: Enabled
Cookies Enabled:Enabled
Java Enabled: Enabled

Browser (User-Agent): Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Time and Date: 6:00:26 PM - Monday, October 12, 2009
Javascript: Enabled
Cookies Enabled:Enabled


Version: unspecified
Severity: major
OS: Windows XP
Platform: PC

Attached:

Details

Reference
bz21112

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:55 PM
bzimport set Reference to bz21112.

(In reply to comment #0)

  1. Search for "[^]he" and replace a string

That's an invalid regex. We should handle that more gracefully than a browser error, of course.

wikibugs wrote:

Reporting against Babaco Release : r57727

Steps to Reproduce ::

Browser : IE7 or IE8

  1. Select a random page
  2. Edit a section
  3. Type the following

Test Calcey
Test Calcey
Test Calcey

  1. Opern serach and replace and search for [a-z][^]st and replace it with QA
  2. Click on "Replace All"

<< Message : The regular expression you entered is invalid: Expected ']' in regular expression >>

  1. Then the search string change for [a-z][^ ]st

<<Test replace with QA>>

<<[a-z][^]st and [a-z][^ ]st both regular expressions are work in all other browsers>>

<<Opera 9.6 [a-z][^]st not find any strings and [a-z][^ ]st is replacing the the search sting>>

Expected Outcome::
regular expression replace should be same for all the browsers

Test Environmet::

Browser (User-Agent): Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506)

Browser (User-Agent): Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;Trident/4.0)

Browser (User-Agent): Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0

Browser (User-Agent): Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.28 (KHTML, like Gecko) Version/3.2.2 Safari/525.28.1

Browser (User-Agent): Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0 (.NET CLR 3.5.30729)

Browser (User-Agent): Opera/9.63 (Windows NT 6.0; U; en) Presto/2.1.1

Browser (User-Agent): Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.00

(In reply to comment #3)

Expected Outcome::
regular expression replace should be same for all the browsers

We can't help that some browsers have different ideas of valid regexes than others. Not our fault, so reclosing. AFAIK, [^] is an invalid regex.